/// <summary> /// 保存对应线 /// </summary> /// <param name="CResultPtLt">点数组(包含对应线信息)</param> /// <param name="strFileName">文件名</param> /// <param name="strPath">保存路径</param> /// <param name="m_mapControl">地图控件</param> public static void SaveCtrlLine(List <List <CCorrCpts> > CtrlCptLtLt, string strFileName, double dblStandardLength, IWorkspace pWorkspace, IMapControl4 m_mapControl) { List <CPolyline> CtrlCplLt = GenerateCplLt(CtrlCptLtLt); int intCount = CtrlCptLtLt.GetCountItem(); List <CPolyline> cpllt1 = new List <CPolyline>(intCount); List <CPolyline> cpllt2 = new List <CPolyline>(intCount); foreach (CPolyline CtrlCpl in CtrlCplLt) { CtrlCpl.SetPolyline(); if (CCmpMethods.CmpDbl_CoordVerySmall(CtrlCpl.pPolyline.Length, dblStandardLength) == 0) { cpllt1.Add(CtrlCpl); } else { cpllt2.Add(CtrlCpl); } } SaveCPlLt(cpllt2, strFileName + "_UnPrecise", pWorkspace, m_mapControl, intRed: 255); SaveCPlLt(cpllt1, strFileName + "_Precise", pWorkspace, m_mapControl, intRed: 255); }
public static int CmpCrg_CphGIDTypeIndex(CRegion crg1, CRegion crg2) { int intResult = crg1.GetCphCount().CompareTo(crg2.GetCphCount()); if (intResult == 0) { intResult = crg1.intSumCphGID.CompareTo(crg2.intSumCphGID); } if (intResult == 0) { intResult = crg1.intSumTypeIndex.CompareTo(crg2.intSumTypeIndex); } if (intResult == 0) { //this will compare the GID of every CPatch in the two SortedDictionary intResult = CCmpMethods.CmpWithSameElements(crg1.GetCphCol(), crg2.GetCphCol(), cph => cph); } if (intResult == 0) { intResult = CCmpMethods.CmpWithSameElements(crg1.GetCphTypeIndexCol(), crg2.GetCphTypeIndexCol(), intTypeIndex => intTypeIndex); } return(intResult); }
public override int Compare(CEdge cedge1, CEdge cedge2) { int intResultDiff = (cedge1.ToCpt.indexID - cedge1.FrCpt.indexID) .CompareTo(cedge2.ToCpt.indexID - cedge2.FrCpt.indexID); int intResultFF = cedge1.FrCpt.indexID.CompareTo(cedge2.FrCpt.indexID); return(CCmpMethods.HandleTwoResults(intResultDiff, intResultFF)); }
/// <summary> /// Compare two cedges, by coordinates /// </summary> /// <returns>1, if the first parameter larger than the second one; -1, smaller; 0, equal</returns> /// <remarks>First comapre FrCpts. If the two cedges have the same FrCpts, then compare ToCpts. /// If they neither have the same FrCpts nor have the same ToCpts, /// then compare FrCpt with ToCpt as well as ToCpt with FrCpt to find whether they are equal</remarks> public static int CmpCEdgeCoord(CEdge cedge1, CEdge cedge2, bool blnMayFlip = false) { GetCpts(cedge1, blnMayFlip, out CPoint frcpt1, out CPoint tocpt1); GetCpts(cedge2, blnMayFlip, out CPoint frcpt2, out CPoint tocpt2); int intResultFF = CmpCptYX(frcpt1, frcpt2); int intResultTT = CmpCptYX(tocpt1, tocpt2); return(CCmpMethods.HandleTwoResults(intResultFF, intResultTT)); }
public override int Compare(CPatch cph1, CPatch cph2) { int intResult = cph1.intSumCpgGID.CompareTo(cph2.intSumCpgGID); if (intResult == 0) { intResult = CCmpMethods.CmpColConsideringCount(cph1.CpgSS, cph2.CpgSS, cpg => cpg.GID); } return(intResult); }
public override int Compare(CPatch cph1, CPatch cph2) { int intResult = CCmpMethods.CmpDbl_CoordVerySmall(cph1.dblArea, cph2.dblArea); if (intResult == 0) { intResult = cph1.GID.CompareTo(cph2.GID); } return(intResult); }
//public static CCmpDbl_CoordVerySmall sComparer = new CCmpDbl_CoordVerySmall(); public override bool Equals(CEdge x, CEdge y) { if (CCmpMethods.CmpCEdgeCoord(x, y, true) == 0) { return(true); } else { return(false); } }
public override int Compare(CRegion crg1, CRegion crg2) { int intResult = CCmpMethods.CmpDbl_ConstVerySmall(crg1.dblCostExact, crg2.dblCostExact); //int intResult = crg1.dblCostExact.CompareTo(crg2.dblCostExact); if (intResult == 0) { intResult = CCmpMethods.CmpCrg_CphGIDTypeIndex(crg1, crg2); } return(intResult); }
///// <summary>whether dblValue is in (dblbound1, dblbound2) or (dblbound2, dblbound1) </summary> ///// <returns> If dblValue is in the range, return 1; ///// If dblValue is on the boundary of the range, return 0 ///// If dblValue is outside of the boundary, return -1</returns> //public static int InBetween(double dblValue, double dblbound1, double dblbound2) //{ // if (dblbound1 > dblbound2) // { // CHelpFunc.Swap(ref dblbound1, ref dblbound2); // } // int intCmp1 = Compare(dblValue, dblbound1); // int intCmp2 = Compare(dblValue, dblbound2); // if (intCmp1 == -1 || intCmp2 == 1) // { // return -1; // } // else if (intCmp1 == 0 || intCmp2 == 0) // { // return 0; // } // else // { // return 1; // } //} public static double SnapValueToTarget(double dblValue, double dblTarget, double dblSnapRange) { if (CCmpMethods.CmpDblRange(dblValue, dblTarget, dblSnapRange) == 0) { return(dblTarget); } else { return(dblValue); } }
//public static CCmpDbl_CoordVerySmall sComparer = new CCmpDbl_CoordVerySmall(); public override bool Equals(CPoint x, CPoint y) { if (CCmpMethods.CmpCptYX(x, y) == 0) { return(true); } else { return(false); } }
public override int Compare(CEdge cedge1, CEdge cedge2) { int intSmallGID1 = Math.Min(cedge1.FrCpt.GID, cedge1.ToCpt.GID); int intLargeGID1 = Math.Max(cedge1.FrCpt.GID, cedge1.ToCpt.GID); int intSmallGID2 = Math.Min(cedge2.FrCpt.GID, cedge2.ToCpt.GID); int intLargeGID2 = Math.Max(cedge2.FrCpt.GID, cedge2.ToCpt.GID); int intSmallResult = intSmallGID1.CompareTo(intSmallGID2); int intLargeResult = intLargeGID1.CompareTo(intLargeGID2); return(CCmpMethods.HandleTwoResults(intSmallResult, intLargeResult)); }
public override int Compare(CRegion crg1, CRegion crg2) { //int intResult = crg1.GetCphCol().GetFirstT().dblArea.CompareTo(crg2.GetCphCol().GetFirstT().dblArea); int intResult = CCmpMethods.CmpDbl_CoordVerySmall (crg1.GetCphCol().First().dblArea, crg2.GetCphCol().First().dblArea); if (intResult == 0) { intResult = CCmpMethods.CmpCrg_CphGIDTypeIndex(crg1, crg2); } return(intResult); }
public override int GetHashCode(CEdge cedge) { CPoint frcpt; CPoint tocpt; CCmpMethods.GetCpts(cedge, true, out frcpt, out tocpt); var x1 = Convert.ToInt64(frcpt.X * CConstants.dblRationVerySmallFclipper); var y1 = Convert.ToInt64(frcpt.Y * CConstants.dblRationVerySmallFclipper); var x2 = Convert.ToInt64(tocpt.X * CConstants.dblRationVerySmallFclipper); var y2 = Convert.ToInt64(tocpt.Y * CConstants.dblRationVerySmallFclipper); return(Tuple.Create(x1, y1, x2, y2).GetHashCode()); }
public static int CmpColConsideringCount <T, TOrder>(ICollection <T> pCol1, ICollection <T> pCol2, Func <T, TOrder> orderFunc = null, IComparer <TOrder> cmp = null, bool blnReverse = false) { int intResult = pCol1.Count.CompareTo(pCol2.Count); if (intResult == 0) { intResult = CCmpMethods.CmpWithSameElements(pCol1, pCol2, orderFunc, cmp); } if (blnReverse == true) { intResult = intResult * -1; } return(intResult); }
public static int CmpCEdgeGID(CEdge cedge1, CEdge cedge2, bool blnMayFlip = false) { CPoint frcpt1; CPoint tocpt1; GetCpts(cedge1, blnMayFlip, out frcpt1, out tocpt1); CPoint frcpt2; CPoint tocpt2; GetCpts(cedge2, blnMayFlip, out frcpt2, out tocpt2); int intResultFF = frcpt1.GID.CompareTo(frcpt2.GID); int intResultTT = tocpt1.GID.CompareTo(tocpt2.GID); return(CCmpMethods.HandleTwoResults(intResultFF, intResultTT)); }
public override int Compare(IList <object> lt1, IList <object> lt2) { int intResult = CCmpMethods.CmpDbl_ConstVerySmall (Convert.ToDouble(lt1[3]), Convert.ToDouble(lt2[3])); //overesimation factor if (intResult == 0) { intResult = CCmpMethods.CmpDbl_ConstVerySmall (Convert.ToDouble(lt1[1]), Convert.ToDouble(lt2[1])); //patch number } if (intResult == 0) { intResult = CCmpMethods.CmpDbl_ConstVerySmall (Convert.ToDouble(lt1[2]), Convert.ToDouble(lt2[2])); //adjacency number } if (intResult == 0) { intResult = CCmpMethods.CmpDbl_ConstVerySmall (Convert.ToDouble(lt1[0]), Convert.ToDouble(lt2[0])); //domain id } return(-intResult); }
//CaseInsensitiveComparer MyCompare = new CaseInsensitiveComparer(); public override int Compare(double x, double y) { return(CCmpMethods.CmpDblPostLocateEqual(x, y)); }
public override int Compare(CCorrCphs CorrCphs1, CCorrCphs CorrCphs2) { return(CCmpMethods.CmpDual(CorrCphs1, CorrCphs2, CorrCphs => CorrCphs.FrCph.GID, CorrCphs => CorrCphs.ToCph.GID)); }
public override int Compare(CRegion crg1, CRegion crg2) { return(CCmpMethods.CmpCrg_CphGIDTypeIndex(crg1, crg2)); }
public override int Compare(CRegion crg1, CRegion crg2) { return(CCmpMethods.CmpCrg_nmID(crg1, crg2)); }
public override int Compare(double x, double y) { return(CCmpMethods.CmpDbl_CoordVerySmall(x, y)); }
public int CompareTo(CCheckRange other) { return(CCmpMethods.CmpDual(this, other, checkrange => checkrange.strFileName, checkrange => checkrange.intStartline)); }
public override int Compare(CEdge cedge1, CEdge cedge2) { return(CCmpMethods.CmpCEdgeCoord(cedge1, cedge2, true)); }
public override int Compare(CPoint cpt1, CPoint cpt2) { return(CCmpMethods.CmpCptYX(cpt1, cpt2)); }
public override int Compare(CptEdgeDis x, CptEdgeDis y) { return(CCmpMethods.CmpDual(x, y, cptEdgeDis => cptEdgeDis.t, cptEdgeDis => cptEdgeDis.GID)); }
public override int Compare(Tuple <T1, T2, T3> tuple1, Tuple <T1, T2, T3> tuple2) { return(CCmpMethods.CmpTernary(tuple1, tuple2, tuple => tuple.Item1, tuple => tuple.Item2, tuple => tuple.Item3)); }