コード例 #1
0
        public virtual int CompareTo(IBranchFeature other)
        {
            if (this == other)
            {
                return(0);
            }
            if (null == Branch)
            {
                throw new Exception("Cannot compare branch features that are not connected to a branch.");
            }
            if (other.Branch != branch)
            {
                return(Branch.CompareTo(other.Branch));
            }
            if (Chainage > other.Chainage)
            {
                return(1);
            }
            if (Math.Abs(Chainage - other.Chainage) < Epsilon)
            {
                // in some cases branch features are defined at the same location and differ only in name
                if (Name != other.Name)
                {
                    return(String.Compare(Name, other.Name, StringComparison.Ordinal));
                }

                return(0);
            }
            return(-1);
        }
コード例 #2
0
 public int CompareTo(IBranchFeature other)
 {
     if (this == other)
     {
         return(0);
     }
     if (null == Branch)
     {
         throw new Exception("Cannot compare branch features that are not connected to a branch.");
     }
     if (other.Branch != branch)
     {
         return(Branch.CompareTo(other.Branch));
     }
     if (Offset > other.Offset)
     {
         return(1);
     }
     return(-1);
 }