Exemplo n.º 1
0
        public String GetMaxRatio(RangeInfoCacheWrapper range)
        {
            if (range.ActivityPauselessCadenceTrack.Count > 0)
            {
                double        maxRatio = GetMaxRatioValue(range);
                SprocketCombo combo    = FindComboFromRatio(maxRatio, range.Activity);

                // We must refresh our cache, something changed in our activity
                if (combo == null)
                {
                    range.SaveStoredInfo(m_GearTrackStoredInfoId, null);
                    range.SaveStoredInfo(m_SprocketTrackStoredInfoId, null);
                    range.SaveStoredInfo(m_SprocketStoredInfoId, null);

                    maxRatio = GetMaxRatioValue(range);
                    combo    = FindComboFromRatio(maxRatio, range.Activity);
                }

                Debug.Assert(combo != null);

                return(String.Format("{0:0.00} ({1:0}x{2:0})", Math.Round(maxRatio, 2), combo.ChainringSize, combo.CassetteSize));
            }

            return(String.Empty);
        }
Exemplo n.º 2
0
        public IList <SprocketComboInfo> GetSprocketComboInfo(RangeInfoCacheWrapper range, ITimeDataSeries <SprocketCombo> sprocketTrack)
        {
            IList <SprocketComboInfo> result;

            if (range.ContainsStoredInfo(m_SprocketStoredInfoId) &&
                range.RetrieveStoredInfo(m_SprocketStoredInfoId) != null)
            {
                result = range.RetrieveStoredInfo(m_SprocketStoredInfoId) as IList <SprocketComboInfo>;
            }
            else
            {
                result = Common.Data.Calculate(range.Activity, sprocketTrack);

                // Remove totals row
                result.RemoveAt(result.Count - 1);

                range.SaveStoredInfo(m_SprocketStoredInfoId, result);
            }

            return(result);
        }
Exemplo n.º 3
0
        public ITimeDataSeries <SprocketCombo> GetRangeSprocketsTrack(RangeInfoCacheWrapper range)
        {
            ITimeDataSeries <SprocketCombo> result = null;

            if (range.ContainsStoredInfo(m_SprocketTrackStoredInfoId) &&
                range.RetrieveStoredInfo(m_SprocketTrackStoredInfoId) != null)
            {
                result = range.RetrieveStoredInfo(m_SprocketTrackStoredInfoId) as ITimeDataSeries <SprocketCombo>;
            }
            else
            {
                INumericTimeDataSeries gears = ActivityGearTrackCache.Instance.CalculateGearTrack(range.Activity);

                gears = Utils.Utils.RemovePausedTimesInTrack(gears, range.Activity);

                NumericTimeDataSeries tempResult = new NumericTimeDataSeries();
                Utils.Utils.ExtractRangeFromDataTrack(gears, range.PauselessRange, tempResult);
                result = GearChart.UI.GearUtils.GuessSprockets(tempResult, Common.Data.GetSprocketCombos(range.Activity));

                range.SaveStoredInfo(m_SprocketTrackStoredInfoId, result);
            }

            return(result);
        }