double CharToRatio(Char c) { int pos = STR_MAPPING.IndexOf(c); if (pos != -1) { return((pos - DELTA) / (2 * 100.0)); } else { throw new ArgumentException(); } }
double CharToRatio(Char c) { int pos = STR_MAPPING.IndexOf(c); if (pos != -1) { return(((pos - delta_) / 100.0) * StepChar_); } else { throw new ArgumentException(); } }
public override string GetRatioString(double ratio) { int r = (int)(ratio * 100 * 2); if (r > MAXRATIO) { return(STR_MAPPING.ElementAt(MAXRATIO + DELTA).ToString()); } else if (r < MINRATIO) { return(STR_MAPPING.ElementAt(MINRATIO + DELTA).ToString()); } else { return(STR_MAPPING.ElementAt(r + DELTA).ToString()); } }
public override string GetRatioString(double ratio) { double val = ((ratio * 100) / StepChar_); int r = (int)Math.Round(val); delta_ = maxRatio_; if (r > maxRatio_) { return(STR_MAPPING.ElementAt(maxRatio_ + delta_).ToString()); } else if (r < minRatio_) { return(STR_MAPPING.ElementAt(minRatio_ + delta_).ToString()); } else { return(STR_MAPPING.ElementAt(r + delta_).ToString()); } }