private static Fraction GetFraction(BinaryReader br) { Fraction fra = new Fraction(); int count = br.ReadInt32(); if (count > 0) { for (int i = 0; i < count; i++) { FractionPoint pt = new FractionPoint(); pt.X = br.ReadInt32(); pt.Y = br.ReadInt32(); pt.Z = br.ReadInt32(); fra.AddPoint(pt); } } return(fra); }
/// <summary> /// 数据库存储 /// </summary> /// <param name="pts"></param> public void FromString(string pts) { m_fractions.Clear(); string[] ptArray = pts.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); // int ptCnt = ptArray.Length / 3; int readTimes = 0; for (int i = 0; i < ptArray.Length && readTimes < ptCnt; i += 3) { FractionPoint pt = new FractionPoint(); pt.X = System.Convert.ToInt32(ptArray[i]); pt.Y = System.Convert.ToInt32(ptArray[i+1]); pt.Z = System.Convert.ToInt32(ptArray[i+2]); AddPoint(pt); readTimes++; } }
/// <summary> /// 数据库存储 /// </summary> /// <param name="pts"></param> public void FromString(string pts) { m_fractions.Clear(); string[] ptArray = pts.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); // int ptCnt = ptArray.Length / 3; int readTimes = 0; for (int i = 0; i < ptArray.Length && readTimes < ptCnt; i += 3) { FractionPoint pt = new FractionPoint(); pt.X = System.Convert.ToInt32(ptArray[i]); pt.Y = System.Convert.ToInt32(ptArray[i + 1]); pt.Z = System.Convert.ToInt32(ptArray[i + 2]); AddPoint(pt); readTimes++; } }
public void AddPoint(FractionPoint pt) { m_fractions.Add(pt); }