Exemplo n.º 1
0
        //Input: 2 segments
        //Output: The distance between them
        public static double getDistance(SegmentClient s1, SegmentClient s2)
        {
            double a = (s2.latitude - s1.latitude) * (s2.latitude - s1.latitude);
            double b = (s2.longitude - s1.longitude) * (s2.longitude - s1.longitude);
            double c = a + b;

            return(Math.Sqrt(c));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the StravaClient class.
        /// </summary>
        /// <param name="authenticator">The IAuthentication object that holds a valid Access Token.</param>
        /// <seealso cref="WebAuthentication"/>
        /// <seealso cref="StaticAuthentication"/>
        public StravaClient(IAuthentication authenticator)
        {
            if (authenticator != null)
            {
                _authenticator = authenticator;

                Activities = new ActivityClient(authenticator);
                Athletes   = new AthleteClient(authenticator);
                Clubs      = new ClubClient(authenticator);
                Gear       = new GearClient(authenticator);
                Segments   = new SegmentClient(authenticator);
                Streams    = new StreamClient(authenticator);
                Uploads    = new UploadClient(authenticator);
                Efforts    = new EffortClient(authenticator);
            }
            else
            {
                throw new ArgumentException("The IAuthentication object must not be null.");
            }
        }