public static IFeatureLayer SavePointLayer(List <CPolyBase> CpbLt, string strName, double dblSize) { var pstrFieldNameLt = new List <string> { "PID" }; var pesriFieldTypeLt = new List <esriFieldType> { esriFieldType.esriFieldTypeInteger }; var pobjectValueLtLt = new List <List <object> >(CpbLt.Count); //读取线数据 var cptlt = new List <CPoint>(); for (int i = 0; i < CpbLt.Count; i++) { for (int j = 0; j < CpbLt[i].CptLt.Count; j++) { cptlt.Add(CpbLt[i].CptLt[j]); pobjectValueLtLt.Add(new List <object> { j }); } } return(CSaveFeature.SaveCptEb(cptlt, strName, pstrFieldNameLt, pesriFieldTypeLt, pobjectValueLtLt, dblWidth: dblSize)); }
public void MatchAndMergePolylines() { var ParameterInitialize = _ParameterInitialize; //List<CPolyline> pCPlLt = this.ObjCGeoLtLt[0].AsExpectedClassEb<CPolyline, CGeoBase>().ToList(); List <CPolyline> LSCPlLt = this.ObjCGeoLtLt[0].AsExpectedClassEb <CPolyline, CGeoBase>().ToList(); List <CPolyline> SSCPlLt = this.ObjCGeoLtLt[1].AsExpectedClassEb <CPolyline, CGeoBase>().ToList(); long lngStartTime = System.Environment.TickCount; List <CPolyline> LSAttentionCPlLt = new List <CPolyline>(); List <CPolyline> SingleCPlLt = MatchPolyline(ref LSCPlLt, ref SSCPlLt, ref LSAttentionCPlLt); List <CPolyline> SSAttentionCPlLt = new List <CPolyline>(); List <CCorrSegment> pCorrCplLt = UnionLSCPl(ref SSCPlLt, ref LSAttentionCPlLt, ref SSAttentionCPlLt); //Save CSaveFeature.SaveCGeoEb(SSAttentionCPlLt, esriGeometryType.esriGeometryPolyline, "SSAttentionCPl"); CSaveFeature.SaveCGeoEb(LSAttentionCPlLt, esriGeometryType.esriGeometryPolyline, "LSAttentionCPl"); CSaveFeature.SaveCGeoEb(SingleCPlLt, esriGeometryType.esriGeometryPolyline, "SingleCPl"); List <CPolyline> pLSCPlLt = new List <CPolyline>(); //the code has to be checked************************************** List <CPolyline> pSSCPlLt = new List <CPolyline>(); //the code has to be checked************************************** for (int i = 0; i < pCorrCplLt.Count; i++) //the code has to be checked************************************** { pLSCPlLt.Add(pCorrCplLt[i].CFrPolyline); pSSCPlLt.Add(pCorrCplLt[i].CToPolyline); } //pLSCPlLt and pSSCPlLt has to be saved because there are may be LSAttentionCPlLt and SSAttentionCPlLt CSaveFeature.SaveCGeoEb(pSSCPlLt, esriGeometryType.esriGeometryPolyline, ParameterInitialize.pFLayerLt[1].Name + "SSCPl"); CSaveFeature.SaveCGeoEb(pLSCPlLt, esriGeometryType.esriGeometryPolyline, ParameterInitialize.pFLayerLt[0].Name + "LSCPl"); }
public IEnumerable <CRegion> AggregateSmallestAndUpdateQ(CRegion crg, CRegion lscrg, CRegion sscrg, SortedSet <CRegion> Q, List <SortedDictionary <CRegion, CRegion> > ExistingCrgSDLt, List <SortedDictionary <CPatch, CPatch> > ExistingCphSDLt, SortedDictionary <CCorrCphs, CCorrCphs> ExistingCorrCphsSD, double[,] padblTD, int intEstSteps) { var pAdjCorrCphsSD = crg.AdjCorrCphsSD; var mincph = crg.GetSmallestCph(); var pCphRecords = crg.GetNeighborCphRecords(mincph).ToList(); if (pCphRecords.Count == 0) { CSaveFeature.SaveCpgEb(mincph.CpgSS, "PolygonsOfMincph"); throw new ArgumentNullException("There is no neighbor of mincph!"); } //for every pair of neighboring Cphs, we aggregate them and generate a new Crg foreach (var pCphRecord in pCphRecords) { foreach (var item in AggregateAndUpdateQ_Common(crg, lscrg, sscrg, Q, pAdjCorrCphsSD, pCphRecord.CorrCphs, ExistingCrgSDLt, ExistingCphSDLt, ExistingCorrCphsSD, padblTD, intEstSteps)) { yield return(item); } } }
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()); }
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 UnifyIndicesPolylines() { var ParameterInitialize = _ParameterInitialize; //List<CPolyline> pCPlLt = this.ObjCGeoLtLt[0].Select(cgeo => cgeo as CPolyline).ToList(); List <CPolyline> LSCPlLt = this.ObjCGeoLtLt[0].Select(cgeo => cgeo as CPolyline).ToList(); List <CPolyline> SSCPlLt = this.ObjCGeoLtLt[1].Select(cgeo => cgeo as CPolyline).ToList(); long lngStartTime = System.Environment.TickCount; MatchPolyline(ref LSCPlLt, ref SSCPlLt); List <CPolyline> LSAttentionCPlLt = new List <CPolyline>(); List <CPolyline> SSAttentionCPlLt = new List <CPolyline>(); List <CCorrSegment> pCorrCplLt = UnifyIndices(ref LSCPlLt, ref SSCPlLt, ref LSAttentionCPlLt, ref SSAttentionCPlLt); //CSaveFeature.SaveCGeoEb(SingleCPlLt, esriGeometryType.esriGeometryPolyline, "SingleCPl", ParameterInitialize.pWorkspace, ParameterInitialize.m_mapControl); CSaveFeature.SaveCGeoEb(SSAttentionCPlLt, esriGeometryType.esriGeometryPolyline, "SSAttentionCPl"); CSaveFeature.SaveCGeoEb(LSAttentionCPlLt, esriGeometryType.esriGeometryPolyline, "LSAttentionCPl"); List <CPolyline> pLSCPlLt = new List <CPolyline>(); //the code has to be checked************************************** List <CPolyline> pSSCPlLt = new List <CPolyline>(); //the code has to be checked************************************** for (int i = 0; i < pCorrCplLt.Count; i++) //the code has to be checked************************************** { pLSCPlLt.Add(pCorrCplLt[i].CFrPolyline); pSSCPlLt.Add(pCorrCplLt[i].CToPolyline); } //pLSCPlLt and pSSCPlLt has to be saved because there are may be LSAttentionCPlLt and SSAttentionCPlLt CSaveFeature.SaveCGeoEb(pSSCPlLt, esriGeometryType.esriGeometryPolyline, ParameterInitialize.pFLayerLt[1].Name + "SSCPl"); CSaveFeature.SaveCGeoEb(pLSCPlLt, esriGeometryType.esriGeometryPolyline, ParameterInitialize.pFLayerLt[0].Name + "LSCPl"); }
//Stopwatch _pstopwatch = new Stopwatch(); #region Output public void Output(double dblProp, string strSimplification, string strBufferStyle, double dblMiterLimit) { CConstants.dblVerySmallCoord *= CConstants.dblFclipper; var resultCpgEb = GetResultCpgEb(this.MergedCpgLt, dblProp, strSimplification, strBufferStyle, dblMiterLimit); CSaveFeature.SaveCpgEb(resultCpgEb, dblProp + "_Growing", intBlue: 255, blnVisible: false); CConstants.dblVerySmallCoord /= CConstants.dblFclipper; }
/// <summary> /// /// </summary> /// <remarks>construct DCEL for InterLSCPlLt, and set the two face numbers for every Cpl. /// since InterSSCPlLt are stored with the same order as InterLSCPlLt, /// we also set the same faces numbers for every Cpl from InterSSCPlLt for a SgCpl, /// we get a point on it and test in which face this point is</remarks> public void IdentifyAddFaceNumber() { CParameterInitialize pParameterInitialize = _ParameterInitialize; _intInterLS = 0; _intInterSS = 1; _intSg = 2; List <CPolyline> pInterLSCPlLt = this.ObjCGeoLtLt[_intInterLS].AsExpectedClassEb <CPolyline, CGeoBase>().ToList(); List <CPolyline> pSgCPlLt = this.ObjCGeoLtLt[_intSg].AsExpectedClassEb <CPolyline, CGeoBase>().ToList(); CDCEL pInterLSDCEL = new CDCEL(pInterLSCPlLt); pInterLSDCEL.ConstructDCEL(); List <object> InterLSobjlt1 = new List <object>(pInterLSCPlLt.Count); List <object> InterLSobjlt2 = new List <object>(pInterLSCPlLt.Count); for (int i = 0; i < pInterLSCPlLt.Count; i++) { int indexID1 = pInterLSCPlLt[i].CEdgeLt[0].cpgIncidentFace.indexID; int indexID2 = pInterLSCPlLt[i].CEdgeLt[0].cedgeTwin.cpgIncidentFace.indexID; //we store the smaller index at "FaceNum_1", and store the larger index at "FaceNum_2" int intSmallerindexID; int intLargerindexID; CHelpFunc.CompareAndOrder(indexID1, indexID2, ID => ID, out intSmallerindexID, out intLargerindexID); InterLSobjlt1.Add(intSmallerindexID); InterLSobjlt2.Add(intLargerindexID); } //it should be true that a polyline of pInterSSCPlLt has the same indices of faces //as the corresponding polyline of pInterLSCPlLt does CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterLS].FeatureClass, esriFieldType.esriFieldTypeInteger, "FaceNum1", InterLSobjlt1); CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterLS].FeatureClass, esriFieldType.esriFieldTypeInteger, "FaceNum2", InterLSobjlt2); CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterSS].FeatureClass, esriFieldType.esriFieldTypeInteger, "FaceNum1", InterLSobjlt1); CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterSS].FeatureClass, esriFieldType.esriFieldTypeInteger, "FaceNum2", InterLSobjlt2); List <object> Sgobjlt = new List <object>(pSgCPlLt.Count); for (int i = 0; i < pSgCPlLt.Count; i++) { Sgobjlt.Add(DetectFaceForSg(pSgCPlLt[i], pInterLSDCEL).indexID); } CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intSg].FeatureClass, esriFieldType.esriFieldTypeInteger, "FaceNum", Sgobjlt); }
public void SaveDataAreaITinEdgeLt(string strName) { var ITinEdgeLt = _pTinEdgeLt; var CEdgeLt = new List <CEdge>(ITinEdgeLt.Count); foreach (var pTinEdge in ITinEdgeLt) { CEdgeLt.Add(new CEdge(pTinEdge)); } CSaveFeature.SaveCEdgeEb(CEdgeLt, "TIN_" + strName); }
public void MergeAndSplitPolylines() { var ParameterInitialize = _ParameterInitialize; List <CPolyline> pCPlLt = this.ObjCGeoLtLt[0].Select(cgeo => cgeo as CPolyline).ToList(); long lngStartTime = System.Environment.TickCount; CDCEL pDCEL = new CDCEL(pCPlLt); pDCEL.ConstructDCEL(); pDCEL.HalfEdgeLt.ForEach(cedge => cedge.isTraversed = false); List <CPolyline> OutputCPlLt = new List <CPolyline>(); int intID = 0; foreach (var cedge in pDCEL.HalfEdgeLt) { if (cedge.isTraversed == true) { continue; } var PreCptLt = new List <CPoint>(); var SucCptLt = new List <CPoint>(); SucCptLt.Add(cedge.ToCpt); GetCptLtUntilIntersection(SucCptLt, cedge.cedgeNext); if (SucCptLt.Count == 1 || SucCptLt.Last().GID != SucCptLt[0].GID) //if it is not a "hole" { PreCptLt.Add(cedge.FrCpt); cedge.isTraversed = true; cedge.cedgeTwin.isTraversed = true; GetCptLtUntilIntersection(PreCptLt, cedge.cedgeTwin.cedgeNext); } PreCptLt.Reverse(); PreCptLt.AddRange(SucCptLt); OutputCPlLt.Add(new CPolyline(intID++, PreCptLt)); } CSaveFeature.SaveCGeoEb(OutputCPlLt, esriGeometryType.esriGeometryPolyline, ParameterInitialize.pFLayerLt[0].Name + "MergeAndSplit"); long lngEndTime = System.Environment.TickCount;//记录结束时间 ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngEndTime - lngStartTime) + "ms"; }
public void MatchAndMergePolygons() { var ParameterInitialize = _ParameterInitialize; var pLSCPgLt = this.ObjCGeoLtLt[0].AsExpectedClassEb <CPolygon, CGeoBase>().ToList(); var pSSCPgLt = this.ObjCGeoLtLt[1].AsExpectedClassEb <CPolygon, CGeoBase>().ToList(); long lngStartTime = System.Environment.TickCount; List <CPolygon> InterLSAttentionCPgLt = new List <CPolygon>(); List <CPolygon> SSAttentionCPgLt = new List <CPolygon>(); MatchCpg(ref pLSCPgLt, ref pSSCPgLt, ref InterLSAttentionCPgLt, ref SSAttentionCPgLt); List <CPolygon> ResultCPgLt = MergeCpg(ref pSSCPgLt); CSaveFeature.SaveCGeoEb(SSAttentionCPgLt, esriGeometryType.esriGeometryPolygon, ParameterInitialize.cboLayerLt[1].Text + "_Attention"); CSaveFeature.SaveCGeoEb(InterLSAttentionCPgLt, esriGeometryType.esriGeometryPolygon, ParameterInitialize.cboLayerLt[0].Text + "_Attention"); CSaveFeature.SaveCGeoEb(ResultCPgLt, esriGeometryType.esriGeometryPolygon, ParameterInitialize.cboLayerLt[0].Text + "_Merged"); }
public void UnifyDirectionsPolylines() { var ParameterInitialize = _ParameterInitialize; //List<CPolyline> pCPlLt = this.ObjCGeoLtLt[0].AsExpectedClassEb<CPolyline, CGeoBase>().ToList(); List <CPolyline> LSCPlLt = this.ObjCGeoLtLt[0].AsExpectedClassEb <CPolyline, CGeoBase>().ToList(); List <CPolyline> SSCPlLt = this.ObjCGeoLtLt[1].AsExpectedClassEb <CPolyline, CGeoBase>().ToList(); for (int i = 0; i < LSCPlLt.Count; i++) { double dblAngleDiff = CGeoFunc.CalAngle_Counterclockwise(LSCPlLt[i].FrCpt, LSCPlLt[i].ToCpt, SSCPlLt[i].FrCpt, SSCPlLt[i].ToCpt); if ((Math.Abs(dblAngleDiff) > (Math.PI / 2) && Math.Abs(dblAngleDiff) < (3 * Math.PI / 2))) { LSCPlLt[i].ReverseCpl(); } } CSaveFeature.SaveCGeoEb(LSCPlLt, esriGeometryType.esriGeometryPolyline, ParameterInitialize.pFLayerLt[0].Name + "UnifiedDirections"); }
public void IdentifyCorrCpgAddRegionNum() { var ParameterInitialize = _ParameterInitialize; var pLSCPgLt = this.ObjCGeoLtLt[0].AsExpectedClassEb <CPolygon, CGeoBase>().ToList(); var pSSCPgLt = this.ObjCGeoLtLt[1].AsExpectedClassEb <CPolygon, CGeoBase>().ToList(); long lngStartTime = System.Environment.TickCount; List <CPolygon> LSAttentionCPgLt = new List <CPolygon>(); List <CPolygon> SSAttentionCPgLt = new List <CPolygon>(); CMatchAndMergePolygons.MatchCpg(ref pLSCPgLt, ref pSSCPgLt, ref LSAttentionCPgLt, ref SSAttentionCPgLt); List <object> LSRgNumLt = new List <object>(pLSCPgLt.Count); LSRgNumLt.EveryElementValue(-1); List <object> SSRgNumLt = new List <object>(pSSCPgLt.Count); foreach (var sscpg in pSSCPgLt) { SSRgNumLt.Add(sscpg.ID); foreach (var corrcgeo in sscpg.CorrCGeoLt) { LSRgNumLt[corrcgeo.ID] = sscpg.ID; } } CSaveFeature.AddFieldandAttribute(ParameterInitialize.pFLayerLt[0].FeatureClass, esriFieldType.esriFieldTypeInteger, "RegionNum", LSRgNumLt); CSaveFeature.AddFieldandAttribute(ParameterInitialize.pFLayerLt[1].FeatureClass, esriFieldType.esriFieldTypeInteger, "RegionNum", SSRgNumLt); CSaveFeature.SaveCGeoEb(SSAttentionCPgLt, esriGeometryType.esriGeometryPolygon, ParameterInitialize.cboLayerLt[1].Text + "_Attention"); CSaveFeature.SaveCGeoEb(LSAttentionCPgLt, esriGeometryType.esriGeometryPolygon, ParameterInitialize.cboLayerLt[0].Text + "_Attention"); }
public void Temporary() { var ParameterInitialize = _ParameterInitialize; var pLSCPlLt = this.ObjCGeoLtLt[0].Select(cgeo => cgeo as CPolyline).ToList(); //var pSSCPlLt = this.ObjCGeoLtLt[1].Select(cgeo => cgeo as CPolyline).ToList(); var subLSCplLt = new List <CPolyline>(pLSCPlLt.Count / 2); var subSSCplLt = new List <CPolyline>(pLSCPlLt.Count / 2); int intI = 0; while (intI < pLSCPlLt.Count) { subLSCplLt.Add(pLSCPlLt[intI++]); subSSCplLt.Add(pLSCPlLt[intI++]); } CSaveFeature.SaveCGeoEb(subLSCplLt, esriGeometryType.esriGeometryPolyline, "InterSgLS_203"); CSaveFeature.SaveCGeoEb(subSSCplLt, esriGeometryType.esriGeometryPolyline, "InterSgSS_203"); }
public List <CPoint> GetOnlyInnerCptLt(bool clockwise = true, bool blnIdentical = true) { //var innercptltlt = new List<List<CPoint>>(); if (_InnerCmptCEdgeLt != null && _InnerCmptCEdgeLt.Count == 1) { return(GetInnerCptEb(_InnerCmptCEdgeLt.First(), clockwise, blnIdentical).ToList()); } else { if (_InnerCmptCEdgeLt != null && _InnerCmptCEdgeLt.Count > 0) { var cpglt = new List <CPolygon>(); foreach (var cptlt in GetInnerCptLtLt()) { cpglt.Add(new CPolygon(-1, cptlt)); } CSaveFeature.SaveCpgEb(clipperMethods.ScaleCpgEb(cpglt, 1 / CConstants.dblFclipper), "OuterFace"); } throw new ArgumentException("This face has no or more than one inner components!"); } }
public void SelectRandomly(double dblPortion) { var iptlt = this.ObjIGeoLtLt[0].AsExpectedClassEb <IPoint, object>().ToList(); var remainIptLt = new List <IPoint>(Convert.ToInt32(dblPortion * iptlt.Count)); var rand = new Random(); foreach (var ipt in iptlt) { var dblrand = rand.NextDouble(); if (dblrand < dblPortion) { remainIptLt.Add(ipt); } } CSaveFeature.SaveIGeoEb(remainIptLt, esriGeometryType.esriGeometryPoint, dblPortion.ToString()); //long lngEndTime = System.Environment.TickCount;//记录结束时间 //ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngEndTime - lngStartTime) + "ms"; //显示运行时 }
//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()); }
public void CGABM() { int intInterLS = 0; int intInterSS = 1; int intSg = 2; int intInterLSSg = 3; int intInterSSSg = 4; var pstrFieldNameLtLt = this.strFieldNameLtLt; var pObjValueLtLtLt = this.ObjValueLtLtLt; var intInterLSFaceNumIndex1 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum1"); var intInterLSFaceNumIndex2 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum2"); var intSgFaceNumIndex = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intSg], "FaceNum"); //count the faces var intInterLSFaceNumSS = new SortedSet <int>(); foreach (var objlt in pObjValueLtLtLt[intInterLS]) { intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex1]); intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex2]); } var intInterLSFaceCount = intInterLSFaceNumSS.Count; _intStart = 0; _intEndCount = intInterLSFaceCount; UpdateStartEnd(); var pInterLSCplLt = new List <CPolyline>(); var pInterSSCplLt = new List <CPolyline>(); var pObjValueLSLtLt = pObjValueLtLtLt[intInterLS]; //the values for the layer of the larger-scale polylines for (int i = 0; i < pObjValueLSLtLt.Count; i++) { int intFaceNum1 = (int)pObjValueLSLtLt[i][intInterLSFaceNumIndex1]; int intFaceNum2 = (int)pObjValueLSLtLt[i][intInterLSFaceNumIndex2]; if ((intFaceNum1 >= _intStart && intFaceNum1 < _intEndCount) || (intFaceNum2 >= _intStart && intFaceNum2 < _intEndCount)) { pInterLSCplLt.Add(this.ObjCGeoLtLt[intInterLS][i] as CPolyline); pInterSSCplLt.Add(this.ObjCGeoLtLt[intInterSS][i] as CPolyline); } } var pInterLSSgCplLt = new List <CPolyline>(); var pInterSSSgCplLt = new List <CPolyline>(); var pObjValueSgLtLt = pObjValueLtLtLt[intSg]; //the values for the layer of the larger-scale polylines for (int i = 0; i < pObjValueSgLtLt.Count; i++) { int intFaceNum = (int)pObjValueSgLtLt[i][intSgFaceNumIndex]; if (intFaceNum >= _intStart && intFaceNum < _intEndCount) { pInterLSSgCplLt.Add(this.ObjCGeoLtLt[intInterLSSg][i] as CPolyline); pInterSSSgCplLt.Add(this.ObjCGeoLtLt[intInterSSSg][i] as CPolyline); } } _CorrCptsLtLt = CGeoFunc.GetCorrCptsLtLt(pInterLSCplLt, pInterSSCplLt); _SgCorrCptsLtLt = CGeoFunc.GetCorrCptsLtLt(pInterLSSgCplLt, pInterSSSgCplLt); CHelpFunc.SetMoveVectorForCorrCptsLtLt(_CorrCptsLtLt); CHelpFunc.SetMoveVectorForCorrCptsLtLt(_SgCorrCptsLtLt); ////to save memory //this.ObjCGeoLtLt[0] = null; //this.ObjCGeoLtLt[1] = null; //this.ObjCGeoLtLt[2] = null; //this.ObjCGeoLtLt[3] = null; //CTranslation pTranslation=new CTranslation (); //double dblSum = pTranslation.CalTranslationCorr(_CorrCptsLtLt); //double dblSumSg = pTranslation.CalTranslationCorr(_SgCorrCptsLtLt); }
public void TopologyCheck() { var ParameterInitialize = _ParameterInitialize; List <CEdge> pAllReadCEdgeLt = _AllReadCEdgeLt; long lngStartTime = System.Environment.TickCount; double dblVerySmall = CConstants.dblVerySmallCoord; throw new ArgumentException("consider setting of dblverysmall!"); for (int i = 0; i < 10; i++) { CConstants.dblVerySmallCoord = dblVerySmall / Math.Pow(10, i - 5); var fEdgeGrid = new CEdgeGrid(pAllReadCEdgeLt); var IntersectionLt = fEdgeGrid.DetectIntersectionsOfExistingEdges(true, true, true); foreach (var cedge in pAllReadCEdgeLt) { cedge.FrCpt.IntersectionLt = new List <CIntersection>(); cedge.ToCpt.IntersectionLt = new List <CIntersection>(); cedge.FrCpt.isTraversed = false; cedge.ToCpt.isTraversed = false; } List <CPoint> CrossCptLt = new List <CPoint>(); //List<CEdge> OverlapEdgeLt = new List<CEdge>(); //to save memory, we don't record overlap edges anymore, instead, we only record an end of the overlap edge List <CPoint> OverlapCptLt = new List <CPoint>(); foreach (CIntersection pIntersection in IntersectionLt) { switch (pIntersection.enumIntersectionType) { case CEnumIntersectionType.NoNo: break; case CEnumIntersectionType.FrFr: pIntersection.CEdge1.FrCpt.IntersectionLt.Add(pIntersection); //End Intersection pIntersection.CEdge2.FrCpt.IntersectionLt.Add(pIntersection); //End Intersection break; case CEnumIntersectionType.FrIn: //CrossCptLt.AddLast(pIntersection.IntersectCpt); //Cross //pIntersection.CEdge1.FrCpt.IntersectionLt.Add(pIntersection); //we don't want to notice this intersection twice, so we add this intersection to the vertice break; case CEnumIntersectionType.FrTo: pIntersection.CEdge1.FrCpt.IntersectionLt.Add(pIntersection); //End Intersection pIntersection.CEdge2.ToCpt.IntersectionLt.Add(pIntersection); //End Intersection break; case CEnumIntersectionType.InFr: //CrossCptLt.AddLast(pIntersection.IntersectCpt); //Cross //pIntersection.CEdge2.FrCpt.IntersectionLt.Add(pIntersection); //we don't want to notice this intersection twice, so we add this intersection to the vertice break; case CEnumIntersectionType.InIn: CrossCptLt.Add(pIntersection.IntersectCpt); //Cross break; case CEnumIntersectionType.InTo: //CrossCptLt.AddLast(pIntersection.IntersectCpt); //Cross //pIntersection.CEdge2.ToCpt.IntersectionLt.Add(pIntersection); //we don't want to notice this intersection twice, so we add this intersection to the vertice break; case CEnumIntersectionType.ToFr: pIntersection.CEdge1.ToCpt.IntersectionLt.Add(pIntersection); //End Intersection pIntersection.CEdge2.FrCpt.IntersectionLt.Add(pIntersection); //End Intersection break; case CEnumIntersectionType.ToIn: //CrossCptLt.AddLast(pIntersection.IntersectCpt); //Cross //pIntersection.CEdge1.ToCpt.IntersectionLt.Add(pIntersection); //we don't want to notice this intersection twice, so we add this intersection to the vertice break; case CEnumIntersectionType.ToTo: pIntersection.CEdge1.ToCpt.IntersectionLt.Add(pIntersection); //End Intersection pIntersection.CEdge2.ToCpt.IntersectionLt.Add(pIntersection); //End Intersection break; case CEnumIntersectionType.Overlap: //OverlapEdgeLt.Add(pIntersection.OverlapCEdge); OverlapCptLt.Add(pIntersection.IntersectCpt); //pIntersection.OverlapCEdge.FrCpt.IntersectionLt.Add(pIntersection); //we don't want to notice this intersection twice, so we add this intersection to the vertice //pIntersection.OverlapCEdge.ToCpt.IntersectionLt.Add(pIntersection); //we don't want to notice this intersection twice, so we add this intersection to the vertice break; default: break; } } CConstants.dblVerySmallCoord = dblVerySmall; List <CPoint> UnLinkedCptLt = new List <CPoint>(); foreach (var cedge in pAllReadCEdgeLt) { if (cedge.FrCpt.isTraversed == false && cedge.FrCpt.IntersectionLt.Count == 0) { UnLinkedCptLt.Add(cedge.FrCpt); } if (cedge.ToCpt.isTraversed == false && cedge.ToCpt.IntersectionLt.Count == 0) { UnLinkedCptLt.Add(cedge.ToCpt); } cedge.FrCpt.IntersectionLt = null; cedge.ToCpt.IntersectionLt = null; cedge.FrCpt.isTraversed = true; cedge.ToCpt.isTraversed = true; } IntersectionLt = null; CSaveFeature.SaveCGeoEb(UnLinkedCptLt, esriGeometryType.esriGeometryPoint, "UnLinkedCpt_" + i.ToString() + "__" + UnLinkedCptLt.Count, blnVisible: false); CHelpFunc.SetAEGeometryNull(UnLinkedCptLt); CSaveFeature.SaveCGeoEb(CrossCptLt, esriGeometryType.esriGeometryPoint, "Crosses_" + i.ToString() + "__" + CrossCptLt.Count, blnVisible: false); CHelpFunc.SetAEGeometryNull(CrossCptLt); CSaveFeature.SaveCGeoEb(OverlapCptLt, esriGeometryType.esriGeometryPoint, "OverlapCpt_" + i.ToString() + "__" + OverlapCptLt.Count, blnVisible: false); CHelpFunc.SetAEGeometryNull(OverlapCptLt); } long lngEndTime = System.Environment.TickCount; //记录结束时间 ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngEndTime - lngStartTime) + "ms"; //显示运行时 }
public void Transform() { int intInterLS = 0; int intInterSS = 1; int intSg = 2; var pParameterInitialize = CConstants.ParameterInitialize; var pstrFieldNameLtLt = this.strFieldNameLtLt; var pObjValueLtLtLt = this.ObjValueLtLtLt; var InterLSIplLt = this.ObjIGeoLtLt[intInterLS].Select(obj => obj as IPolyline5).ToList(); var InterSSIplLt = this.ObjIGeoLtLt[intInterSS].Select(obj => obj as IPolyline5).ToList(); var SgIplLt = this.ObjIGeoLtLt[intSg].Select(obj => obj as IPolyline5).ToList(); var pStopwatch = new Stopwatch(); pStopwatch.Start(); var intInterLSFaceNumIndex1 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum1"); var intInterLSFaceNumIndex2 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum2"); var intSgFaceNumIndex = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intSg], "FaceNum"); //count the faces var intInterLSFaceNumSS = new SortedSet <int>(); foreach (var objlt in pObjValueLtLtLt[intInterLS]) { intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex1]); intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex2]); } var intInterLSFaceCount = intInterLSFaceNumSS.Count; //record the ipolylines into corresponding faces (lists) var InterLSIplLtLt = new List <List <IPolyline5> >(intInterLSFaceCount); var InterSSIplLtLt = new List <List <IPolyline5> >(intInterLSFaceCount); InterLSIplLtLt.EveryElementNew(); InterSSIplLtLt.EveryElementNew(); var pInterLSObjValueLtLt = pObjValueLtLtLt[intInterLS]; //the value table of LSLayer for (int i = 0; i < pInterLSObjValueLtLt.Count; i++) { //pLSObjValueLtLt[i][intInterLSFaceNumIndex1] is the index of a face InterLSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex1]].Add(InterLSIplLt[i]); InterLSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex2]].Add(InterLSIplLt[i]); //we use the same index, i.e.,pLSObjValueLtLt[i][intInterLSFaceNumIndex1], as we use for LS InterSSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex1]].Add(InterSSIplLt[i]); InterSSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex2]].Add(InterSSIplLt[i]); } var SgIplLtLt = new List <List <IPolyline5> >(intInterLSFaceCount); var intSgIndexLtLt = new List <List <int> >(intInterLSFaceCount); SgIplLtLt.EveryElementNew(); intSgIndexLtLt.EveryElementNew(); var pSgObjValueLtLt = pObjValueLtLtLt[intSg]; //the value table of LSLayer for (int i = 0; i < pSgObjValueLtLt.Count; i++) { //pLSObjValueLtLt[i][intInterLSFaceNumIndex1] is the index of a face SgIplLtLt[(int)pSgObjValueLtLt[i][intSgFaceNumIndex]].Add(SgIplLt[i]); //we record the index of every polyline //so that later we can store the transformed polylines with the same orders as SgIplLt intSgIndexLtLt[(int)pSgObjValueLtLt[i][intSgFaceNumIndex]].Add(i); } //var dlgTransform = SetDlgTransform(pParameterInitialize.cboTransform.Text); var TransSgIGeoLt = new List <IGeometry>(SgIplLt.Count); TransSgIGeoLt.EveryElementValue(null); CHelpFunc.Displaytspb(0.5, intInterLSFaceCount); _intStart = 0; _intEndCount = intInterLSFaceCount; UpdateStartEnd(); for (int i = _intStart; i < _intEndCount; i++) { Console.WriteLine("Face Num: " + i); if (SgIplLtLt[i].Count != 0) //face 0 is the outer face, the count is zero { List <CPolyline> TransSgCplLt; switch (pParameterInitialize.cboTransform.Text) { case "CT Max Common Chords": TransSgCplLt = CTTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i], true); break; case "Compatible Triangulations": TransSgCplLt = CTTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i], false); break; case "Rubber Sheeting": TransSgCplLt = RSTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i]); break; default: throw new ArgumentOutOfRangeException("a case doesn't exist!"); } //var TransSgCplEb = dlgTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i]); int intCount = 0; foreach (var TransSgCpl in TransSgCplLt) { TransSgIGeoLt[intSgIndexLtLt[i][intCount++]] = TransSgCpl.JudgeAndSetAEGeometry(); } } CHelpFunc.Displaytspb(i + 1, intInterLSFaceCount); } CHelpFunc.DisplayRunTime(pStopwatch.ElapsedMilliseconds); CSaveFeature.SaveIGeoEb(TransSgIGeoLt, esriGeometryType.esriGeometryPolyline, "TransSgCPlLt", this.strFieldNameLtLt[intSg], this.esriFieldTypeLtLt[intSg], _ObjValueLtLtLt[intSg]); }
//Stopwatch _pstopwatch = new Stopwatch(); #region Output public void Output(double dblT, double dblS) { var strTS = _ParameterInitialize.strTS; var x = dblT; var y = dblS; double dblExtraX = 300; double dblExtraY = 400; if (strTS == "vario_vario") { } else if (strTS == "vario_separate") { y = SetForSeparate(dblS, 0.5); } else if (strTS == "separate_vario") { x = SetForSeparate(dblT, 0.5); } else //if (strTS == "separate_separate") { x = SetForSeparate(dblT, 0.5); y = SetForSeparate(dblS, 0.5); } 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); //double dblMaxDis = olcpl.CptLt[9].DistanceTo(oscpl.CptLt[9]); //double dblMaxDis = 22.36068; //double dblMoveT = dblMaxDis * dblT; //double dblMoveS = dblMaxDis * dblS; //var InterLargerCpl = InterpolateCpl(olcplmoved, nlcplmoved, dblT); //var InterSmallerCpl = InterpolateCpl(oscplmoved, nscplmoved, dblT); //var InterCpl = InterpolateCpl(InterLargerCpl, InterSmallerCpl, dblS); var InterLargerCpl = CGeoFunc.GetInbetweenCpl(olcplmoved, nlcplmoved, dblT); var InterSmallerCpl = CGeoFunc.GetInbetweenCpl(oscplmoved, nscplmoved, dblT); var InterCpl = CGeoFunc.GetInbetweenCpl(InterLargerCpl, InterSmallerCpl, dblS); var simplifedcptlt = CImaiIriSimplify.ImaiIriSimplify(InterCpl.CptLt, 100000 * CConstants.dblVerySmallCoord).ToList(); //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(simplifedcptlt, dblBaseX, dblBaseY).ToList()); CSaveFeature.SaveCpl(movedInterCpl, dblT.ToString() + " " + dblS.ToString()); //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()); }
/// <summary> /// /// </summary> /// <param name="ConstraintCpllt"></param> /// <param name="KnownCEdgeLt"></param> /// <param name="strIdentity"></param> /// <param name="blnSave"></param> /// <remarks>If the "data area" is not set deliberately, then ArcEngine will set a default "data area". /// The default data area excludes super edges and super nodes</remarks> public void Triangulate(List <CPolyline> ConstraintCpllt = null, List <CEdge> KnownCEdgeLt = null, string strIdentity = "", bool blnSave = false) { var cpg = _CPg; //cpg.pPolygon = null; cpg.JudgeAndSetPolygon(); IPointCollection4 pCol = cpg.pPolygon as IPointCollection4; int intCount = pCol.PointCount; var pEnv = cpg.pPolygon.Envelope; ITinEdit TinEdit = new TinClass(); TinEdit.InitNew(pEnv); ITinEdit2 TinEdit2 = TinEdit as ITinEdit2; TinEdit2.SetToConstrainedDelaunay(); //this must be done before adding any feature var pTinAdvanced2 = TinEdit as ITinAdvanced2; ITinFeatureEdit pTinFeatureEdit = TinEdit as ITinFeatureEdit; cpg.JudgeAndSetZToZero(); //we need z coordinate to construct triangulation pTinFeatureEdit.AddPolygonZ(cpg.pPolygon, esriTinEdgeType.esriTinHardEdge, 1, 1, 1, null); if (ConstraintCpllt != null) { foreach (var cpl in ConstraintCpllt) { cpl.JudgeAndSetPolyline(); cpl.JudgeAndSetZToZero(); pTinFeatureEdit.AddPolylineZ(cpl.pPolyline, esriTinEdgeType.esriTinHardEdge, 1, 1, null); } } _pTinAdvanced2 = pTinAdvanced2; //we are not allowed to use AddShapeZ. //it will report that there is no Z value in the shape, even we already set Z value to 0 //The reason may be that we actually need polyhedron //TinEdit.AddShapeZ((IGeometry)cpg.pPolygon, esriTinSurfaceType.esriTinHardClip, 0); //******************************************** //this function set the "data area" of the TIN, //we avoid to use this function because it may introduce new points //the new poins can be very close to the original points //TinEdit.AddShape((IGeometry)cpg.pPolygon, esriTinSurfaceType.esriTinHardClip, 0); //TinEdit.Refresh(); if (pTinAdvanced2.DataNodeCount != this.CptLt.Count) { //Usually, KnownCEdgeLt saves all the constraints for the triangulation CSaveFeature.SaveCEdgeEb(KnownCEdgeLt, "KnownCEdgeLt" + strIdentity); CSaveFeature.SaveCptEb(this.CptLt, "CptLtForKnownCEdgeLt" + strIdentity); var NodeCptLt = GetCptLtFromTinAdvanced(pTinAdvanced2, true); CSaveFeature.SaveCptEb(NodeCptLt, "TinNode" + strIdentity); //var TinCEdgeLt= get var ExtraNodeCptLt = new List <CPoint>(pTinAdvanced2.DataNodeCount - this.CptLt.Count); foreach (var nodeCpt in NodeCptLt) { if (this.CptSD.ContainsKey(nodeCpt) == false) { ExtraNodeCptLt.Add(nodeCpt); } } CSaveFeature.SaveCptEb(ExtraNodeCptLt, "ExtraNodeCptLt" + strIdentity); var TinCEdgeLt = GetCEdgeLtFromTinAdvanced(pTinAdvanced2); CSaveFeature.SaveCEdgeEb(TinCEdgeLt, "TinCEdgeLt" + strIdentity); throw new ArgumentException("the numbers of points should be the same!"); } this.CptLt.SetIndexID(); var ITinEdgeLt = GenerateITinEdgeLt(); var tincedgeSS = new SortedSet <CEdge>(new CCmpEdge_CptGID_BothDirections()); var tincedgelt = new List <CEdge>(); if (KnownCEdgeLt != null) { tincedgeSS = new SortedSet <CEdge>(KnownCEdgeLt, new CCmpEdge_CptGID_BothDirections()); tincedgelt.AddRange(KnownCEdgeLt); } cpg.SetAxisAngleAndReverseLt(); var cptSD = this.CptSD; foreach (var tinedge in ITinEdgeLt) { //there are always a pair of edges between a pair of triangles, but we only need one edge. //So we reverse some edges than we can delete one edge of each pair var pFrNode = tinedge.FromNode; var pToNode = tinedge.ToNode; CPoint frcpt, tocpt; FindCorrCptInSDByTinNode(pFrNode, cptSD, out frcpt); FindCorrCptInSDByTinNode(pToNode, cptSD, out tocpt); CEdge newCEdge; if (frcpt.indexID < tocpt.indexID) { newCEdge = new CEdge(frcpt, tocpt); } else if (frcpt.indexID > tocpt.indexID) { newCEdge = new CEdge(tocpt, frcpt); } else { throw new ArgumentException("should not happen!"); } //test if the new edge is outside the boundary polygon (cpg) if (newCEdge.FrCpt.indexID < cpg.CEdgeLt.Count) { //the new edge starts from a point which constitues the boundary polygon (cpg) newCEdge.SetAxisAngle(); if (CGeoFunc.IsInbetween_Counterclockwise(cpg.AxisAngleLt[newCEdge.FrCpt.indexID], newCEdge.dblAxisAngle, cpg.ReverseAxisAngleLt[newCEdge.FrCpt.indexID]) == false) { //the new edge is outside the boundary polygon (cpg) continue; } } //add the new edge if the edge is not added yet if (tincedgeSS.Add(newCEdge)) { this.NewCEdgeLt.Add(newCEdge); tincedgelt.Add(newCEdge); } } if (blnSave == true) { CSaveFeature.SaveCEdgeEb(tincedgelt, "tincedgelt" + strIdentity, blnVisible: false); } this.CEdgeLt = tincedgelt; }
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); }
public void BldgGrow(string strBufferStyle, double dblMiterLimit, string strSimplification, double dblLS, double dblSS, int intOutputMapCount) { //**********************************************// //I may need to do buffering based on Miterjoint in a more clever way //if the distance from the miter point to original line is larger than dblMiterLimit*dblBufferRadius, we, instead of calling //the normal square method, make a square so that the farthest distance to the original line exactly dblMiterLimit*dblBufferRadius var pParameterInitialize = _ParameterInitialize; var LSCpgLt = this.ObjCGeoLtLt[0].AsExpectedClassEb <CPolygon, CGeoBase>().ToList(); //int intEdgeCount = 0; //double dblArea = 0; //foreach (var cpg in LSCpgLt) //{ // intEdgeCount += cpg.GetEdgeCount(); // cpg.SetAreaSimple(); // dblArea += cpg.dblAreaSimple; //} double dblStartScale = dblLS; double dblFclipper = CConstants.dblFclipper; CConstants.dblFScale = CConstants.dblFclipper; var MagnifiedCpgLt = clipperMethods.ScaleCpgEb(LSCpgLt, dblFclipper).ToList(); CConstants.dblVerySmallCoord *= dblFclipper; int intStart = 0; int intEnd = intStart + intOutputMapCount; CHelpFunc.Displaytspb(0.5, intEnd - intStart); double dblTargetScale = 0; var pStopwatch = Stopwatch.StartNew(); for (int i = intStart; i < intEnd; i++) { //double dblTargetScale = dblStartScale + (i + 1) * 5; switch (i) { case 0: dblTargetScale = 50; //dblTargetScale = 25; break; case 1: dblTargetScale = 100; //dblTargetScale = 50; break; case 2: dblTargetScale = 250; //dblTargetScale = 100; break; case 3: dblTargetScale = 500; //CConstants.blnStop = true; //dblTargetScale = 250; _intI = 3; break; case 4: dblTargetScale = 1000; //CConstants.blnStop = true; //dblTargetScale = 500; _intI = 3; break; default: break; } _dblStartScale = dblStartScale; _dblTargetScale = dblTargetScale; //_dblAreaLimit = 4; //area limit 0.16 mm^2 _dblAreaLimit = 0.16; //area limit 0.16 mm^2 //double dblAreaLimitTargetScale= dblAreaLimit * dblTargetScale * dblTargetScale; _dblEpsilon = 0.2; double dblTargetEpsilon = _dblEpsilon * dblTargetScale * dblFclipper; //_dblLambda = 0.8; //_dblTotalGrow = _dblLambda / 2 * Math.Sqrt(_dblAreaLimit) * (dblTargetScale - dblStartScale); _dblTotalGrow = 25; //_dblTotalGrow *= 50; double dblTotalGrow = _dblTotalGrow * dblFclipper; _dblHoleAreaLimit = 8; //dblHoleAreaLimit=8 mm^2 * dblTargetScale * dblTargetScale double dblHoleAreaLimitTargetScale = _dblHoleAreaLimit * dblTargetScale * dblTargetScale * dblFclipper * dblFclipper; //_dblErosion = _dblTotalGrow / 2; _dblErosion = 1.5 * _dblEpsilon / 2; //To avoid breaking the polygon when we errod, dblOverDilated should not be too large double dblTargetErosion = _dblErosion * dblTargetScale * dblFclipper; //dblTargetErosion = 0; //dblTargetErosion = dblTotalGrow / 2; //_dblDilation should be larger than dblEpsilon * Math.Sqrt(5) / 2 + 4 * dblGrow, because of function GroupAndGetShortestCpipeSD_Overlap //_dblDilation = Math.Sqrt(_dblHoleAreaLimit / Math.PI); //_dblDilation = _dblEpsilon / 2; double dblTargetDilation = (dblTotalGrow - dblMiterLimit * dblTargetErosion) / (dblMiterLimit - 1); //dblTargetDilation = 0; //double dblTargetDilation = dblTotalGrow; //dblTargetDilation= dblTotalGrow / 2; foreach (var MagnifiedCpg in MagnifiedCpgLt) { MagnifiedCpg.RemoveClosePoints(); //MagnifiedCpg.SubCpgLt = new List<CPolygon> { MagnifiedCpg }; MagnifiedCpg.FormCEdgeLt(); MagnifiedCpg.CEdgeLt.ForEach(cedge => cedge.BelongedCpg = MagnifiedCpg); MagnifiedCpg.SetExteriorPath(); //MagnifiedCpg. = CHelpFunc.MakeLt(clipperMethods.GeneratePathByCpgExterior(MagnifiedCpg)); } #region Generate buffers (commented) //var allpaths = new Paths(); //foreach (var MagnifiedCpg in MagnifiedCpgLt) //{ // allpaths.AddRange(MagnifiedCpg.GetAllPaths()); //} //var offsetpaths = clipperMethods.Offset_Paths(allpaths, //dblTotalGrow, strBufferStyle, dblMiterLimit); //CSaveFeature.SavePathEbAsCpgEb(offsetpaths, "offsetpaths"); #endregion //var mergedCpgLt = MergeCloseCpgsAndAddBridges(MagnifiedCpgLt, dblTotalGrow, dblTargetDilation, dblTargetEpsilon); var mergedCpgLt = MergeCloseCpgsAndAddBridges(MagnifiedCpgLt, true, dblTotalGrow, dblTargetDilation, dblTargetEpsilon, strBufferStyle, dblMiterLimit); //dblGrow, dblDilation, dblErosion, dblEpsilon for (int j = 0; j < mergedCpgLt.Count; j++) { var mergedcpg = mergedCpgLt[j]; SetClipCpgLt_BufferDilateErodeSimplify(mergedcpg, dblTotalGrow, dblTargetDilation, dblTargetErosion, dblTargetEpsilon, dblHoleAreaLimitTargetScale, strSimplification, strBufferStyle, dblMiterLimit); //if (mergedcpg.BridgeCptEdgeDisLt != null) //{ // var BridgeCpipeDt = new Dictionary<CValPairIncr<CPolygon>, CptEdgeDis> //(mergedcpg.BridgeCptEdgeDisLt.Count, new CCmpEqCpgPairIncr()); // foreach (var BridgeCptEdgeDis in mergedcpg.BridgeCptEdgeDisLt) // { // BridgeCpipeDt.Add(new CValPairIncr<CPolygon>(BridgeCptEdgeDis.FrCEdge.BelongedCpg, // BridgeCptEdgeDis.ToCEdge.BelongedCpg), BridgeCptEdgeDis); // } // mergedcpg.BridgeCpipeDt = BridgeCpipeDt; //} mergedcpg.LastTimePaths = new Paths(); if (mergedcpg.SubCpgLt == null || mergedcpg.SubCpgLt.Count < 2) { mergedcpg.LastTimePaths.AddRange(mergedcpg.GetAllPaths()); } else { foreach (var subcpg in mergedcpg.SubCpgLt) { mergedcpg.LastTimePaths.AddRange(subcpg.GetAllPaths()); } } dblStartScale = dblTargetScale; CHelpFunc.Displaytspb(j + 1, mergedCpgLt.Count); } int intEdgecountbeforesimplification = CDPSimplify._intEdgeCountBefore; int intEdgecountaftersimplification = CDPSimplify._intEdgeCountAfter; CDPSimplify._intEdgeCountBefore = 0; CDPSimplify._intEdgeCountAfter = 0; CHelpFunc.DisplayRunTime(pStopwatch.ElapsedMilliseconds); this.MergedCpgLt = mergedCpgLt; var clipcpgEb = GetClipCpgEb(mergedCpgLt); CSaveFeature.SaveCpgEb(clipperMethods.ScaleCpgEb(clipcpgEb, 1 / dblFclipper), strSimplification + "_" + dblTargetScale + "k_ClipForm" + dblTargetEpsilon + "m", intOutlineRed: 255, pesriSimpleFillStyle: esriSimpleFillStyle.esriSFSHollow, blnVisible: false); CSaveFeature.SaveCpgEb(clipperMethods.ScaleCpgEb(mergedCpgLt, 1 / dblFclipper), strSimplification + "_" + dblTargetScale + "k_BridgedCpg" + dblTargetEpsilon + "m_", pesriSimpleFillStyle: esriSimpleFillStyle.esriSFSHollow, blnVisible: false); #region Geoprocessor Samples //// Initialize the geoprocessor. ////IGeoProcessor2 gp2 = new GeoProcessorClass(); //Geoprocessor gp = gp = new Geoprocessor(); ////ESRI.ArcGIS.AnalysisTools.Buffer pBuffer = new ESRI.ArcGIS.AnalysisTools.Buffer( //// pParameterInitialize.strSavePathBackSlash + lyroverbuffer.Name, //// pParameterInitialize.strSavePathBackSlash + lyroverbuffer.Name + "_Buffered", 5); ////pBuffer.in_features = pParameterInitialize.m_mapControl.Layer[0] as IDataset; //AggregatePolygons pAggregatePolygons = new AggregatePolygons(); //pAggregatePolygons.in_features = pParameterInitialize.m_mapControl.Layer[0] as IDataset; //pAggregatePolygons.out_feature_class = pParameterInitialize.pWorkspace.PathName + "\\" + "My_Agg"; ////strReturnName = pWorkspace.PathName + "\\" + pDataset.Name + "_Agg"; ; //pAggregatePolygons.orthogonality_option = "ORTHOGONAL"; //pAggregatePolygons.aggregation_distance = "500 Meters"; ////pAggregatePolygons. //gp.Execute(pAggregatePolygons, null); ////execute the buffer tool (very easy :-)) ////gp.Execute(buffer, null); ////IGeoProcessorResult results = (IGeoProcessorResult)gp.Execute(buffer, null); ////ESRI.ArcGIS.CoverageTools.SimplifyBuilding pSimplifyBuilding = new SimplifyBuilding(); ////pSimplifyBuilding.in_cover = pParameterInitialize.strSavePathBackSlash + lyroverbuffer.Name; ////pSimplifyBuilding.out_cover = pParameterInitialize.strSavePathBackSlash + lyroverbuffer.Name +"_Simplified"; ////pSimplifyBuilding.simplification_tolerance = dblEpsilon; ////pSimplifyBuilding.minimum_area = dblA; ////pSimplifyBuilding.CheckConflict = "CHECK_CONFLICT "; ////GP.Execute(pSimplifyBuilding,null); #endregion } CConstants.dblVerySmallCoord /= dblFclipper; }