示例#1
0
文件: Climb.cs 项目: Tylland/altidude
 public Climb(TrackPoint start, TrackPoint end, double ascending, double descending, ClimbCategory category, double slope, double points)
     : base(start, end, ascending, descending)
 {
     Category = category;
     Slope    = slope;
     Points   = points;
 }
示例#2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ClimbCategory != null)
         {
             hashCode = hashCode * 59 + ClimbCategory.GetHashCode();
         }
         if (ClimbCategoryDesc != null)
         {
             hashCode = hashCode * 59 + ClimbCategoryDesc.GetHashCode();
         }
         if (AvgGrade != null)
         {
             hashCode = hashCode * 59 + AvgGrade.GetHashCode();
         }
         if (StartLatlng != null)
         {
             hashCode = hashCode * 59 + StartLatlng.GetHashCode();
         }
         if (EndLatlng != null)
         {
             hashCode = hashCode * 59 + EndLatlng.GetHashCode();
         }
         if (ElevDifference != null)
         {
             hashCode = hashCode * 59 + ElevDifference.GetHashCode();
         }
         if (Distance != null)
         {
             hashCode = hashCode * 59 + Distance.GetHashCode();
         }
         if (Points != null)
         {
             hashCode = hashCode * 59 + Points.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#3
0
        private List <Climb> FindClimbs(TrackPoint[] points)
        {
            var climbs = new List <Climb>();

            for (int i = 0; i < points.Length; i++)
            {
                for (int j = i + 1; j < points.Length; j++)
                {
                    var slope    = CalcSlopeGrade(points[i], points[j]);
                    var distance = CalcAscendingDistance(points, points[i], points[j]);

                    var climbPoints = slope * 100 * distance;

                    var category = ClimbCategory.GetCategory(climbPoints);

                    if (category != null && slope >= ClimbCategory.MinSlope)
                    {
                        climbs.Add(new Climb(points[i], points[j], 0.0, 0.0, category, slope, climbPoints));
                    }
                }
            }

            return(climbs);
        }
示例#4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ActivityType != null)
         {
             hashCode = hashCode * 59 + ActivityType.GetHashCode();
         }
         if (Distance != null)
         {
             hashCode = hashCode * 59 + Distance.GetHashCode();
         }
         if (AverageGrade != null)
         {
             hashCode = hashCode * 59 + AverageGrade.GetHashCode();
         }
         if (MaximumGrade != null)
         {
             hashCode = hashCode * 59 + MaximumGrade.GetHashCode();
         }
         if (ElevationHigh != null)
         {
             hashCode = hashCode * 59 + ElevationHigh.GetHashCode();
         }
         if (ElevationLow != null)
         {
             hashCode = hashCode * 59 + ElevationLow.GetHashCode();
         }
         if (StartLatlng != null)
         {
             hashCode = hashCode * 59 + StartLatlng.GetHashCode();
         }
         if (EndLatlng != null)
         {
             hashCode = hashCode * 59 + EndLatlng.GetHashCode();
         }
         if (ClimbCategory != null)
         {
             hashCode = hashCode * 59 + ClimbCategory.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (State != null)
         {
             hashCode = hashCode * 59 + State.GetHashCode();
         }
         if (Country != null)
         {
             hashCode = hashCode * 59 + Country.GetHashCode();
         }
         if (_Private != null)
         {
             hashCode = hashCode * 59 + _Private.GetHashCode();
         }
         if (AthletePrEffort != null)
         {
             hashCode = hashCode * 59 + AthletePrEffort.GetHashCode();
         }
         if (AthleteSegmentStats != null)
         {
             hashCode = hashCode * 59 + AthleteSegmentStats.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#5
0
        /// <summary>
        /// Returns true if SummarySegment instances are equal
        /// </summary>
        /// <param name="other">Instance of SummarySegment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SummarySegment other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ActivityType == other.ActivityType ||
                     ActivityType != null &&
                     ActivityType.Equals(other.ActivityType)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     AverageGrade == other.AverageGrade ||
                     AverageGrade != null &&
                     AverageGrade.Equals(other.AverageGrade)
                 ) &&
                 (
                     MaximumGrade == other.MaximumGrade ||
                     MaximumGrade != null &&
                     MaximumGrade.Equals(other.MaximumGrade)
                 ) &&
                 (
                     ElevationHigh == other.ElevationHigh ||
                     ElevationHigh != null &&
                     ElevationHigh.Equals(other.ElevationHigh)
                 ) &&
                 (
                     ElevationLow == other.ElevationLow ||
                     ElevationLow != null &&
                     ElevationLow.Equals(other.ElevationLow)
                 ) &&
                 (
                     StartLatlng == other.StartLatlng ||
                     StartLatlng != null &&
                     StartLatlng.Equals(other.StartLatlng)
                 ) &&
                 (
                     EndLatlng == other.EndLatlng ||
                     EndLatlng != null &&
                     EndLatlng.Equals(other.EndLatlng)
                 ) &&
                 (
                     ClimbCategory == other.ClimbCategory ||
                     ClimbCategory != null &&
                     ClimbCategory.Equals(other.ClimbCategory)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     State == other.State ||
                     State != null &&
                     State.Equals(other.State)
                 ) &&
                 (
                     Country == other.Country ||
                     Country != null &&
                     Country.Equals(other.Country)
                 ) &&
                 (
                     _Private == other._Private ||
                     _Private != null &&
                     _Private.Equals(other._Private)
                 ) &&
                 (
                     AthletePrEffort == other.AthletePrEffort ||
                     AthletePrEffort != null &&
                     AthletePrEffort.Equals(other.AthletePrEffort)
                 ) &&
                 (
                     AthleteSegmentStats == other.AthleteSegmentStats ||
                     AthleteSegmentStats != null &&
                     AthleteSegmentStats.Equals(other.AthleteSegmentStats)
                 ));
        }
示例#6
0
        /// <summary>
        /// Returns true if ExplorerSegment instances are equal
        /// </summary>
        /// <param name="other">Instance of ExplorerSegment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ExplorerSegment other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ClimbCategory == other.ClimbCategory ||
                     ClimbCategory != null &&
                     ClimbCategory.Equals(other.ClimbCategory)
                 ) &&
                 (
                     ClimbCategoryDesc == other.ClimbCategoryDesc ||
                     ClimbCategoryDesc != null &&
                     ClimbCategoryDesc.Equals(other.ClimbCategoryDesc)
                 ) &&
                 (
                     AvgGrade == other.AvgGrade ||
                     AvgGrade != null &&
                     AvgGrade.Equals(other.AvgGrade)
                 ) &&
                 (
                     StartLatlng == other.StartLatlng ||
                     StartLatlng != null &&
                     StartLatlng.Equals(other.StartLatlng)
                 ) &&
                 (
                     EndLatlng == other.EndLatlng ||
                     EndLatlng != null &&
                     EndLatlng.Equals(other.EndLatlng)
                 ) &&
                 (
                     ElevDifference == other.ElevDifference ||
                     ElevDifference != null &&
                     ElevDifference.Equals(other.ElevDifference)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     Points == other.Points ||
                     Points != null &&
                     Points.Equals(other.Points)
                 ));
        }