public static void GenerateProperty(Exhibit exhibit) { var timeUnit = exhibit.TimeUnit.ToLower(); if (timeUnit == "ga") { exhibit.x = -exhibit.Year.Value * 1000000000; } else if (timeUnit == "ma") { exhibit.x = -exhibit.Year.Value * 1000000; } else if (timeUnit == "ka") { exhibit.x = -exhibit.Year.Value * 1000; } else if (timeUnit == "bce") { exhibit.x = getCoordinateFromDMY( -exhibit.Year.Value, !exhibit.Month.HasValue ? 0 : Math.Min(11, Math.Max(0, exhibit.Month.Value - 1)), !exhibit.Day.HasValue ? 1 : exhibit.Day.Value ); } else if (timeUnit == "ce") { exhibit.x = getCoordinateFromDMY( exhibit.Year.Value, !exhibit.Month.HasValue ? 0 : Math.Min(11, Math.Max(0, exhibit.Month.Value - 1)), !exhibit.Day.HasValue ? 1 : exhibit.Day.Value ); } }
private static void _GenerateTestingData(Timeline timeline, int level, int depth, int maxNumTimelines, int numChildTimelines, int numChildExhibits, ref int cntTimelines, ref int cntExhibits) { for (var i = 0; i < numChildExhibits; i++) { var eb = new Exhibit(); eb.Title = "Exhibit - " + cntExhibits; eb.TimeUnit = "Ga"; eb.Day = 0; eb.Month = 0; eb.Year = timeline.FromYear + (timeline.ToYear - timeline.FromYear) / 2; cntExhibits++; timeline.Exhibits.Add(eb); } if (level <= depth - 1) { for (var i = 0; i < numChildTimelines; i++) { if (cntTimelines < maxNumTimelines) { var child = new Timeline(); child.Title = "Timeline - " + cntTimelines; child.FromTimeUnit = "Ga"; child.FromDay = 0; child.FromMonth = 0; child.FromYear = 13 - (level + 1); child.ToTimeUnit = "Ga"; child.ToDay = 0; child.ToMonth = 0; child.ToYear = 0; child.Height = 10; cntTimelines++; timeline.ChildTimelines.Add(child); _GenerateTestingData(child, level + 1, depth, maxNumTimelines, numChildTimelines, numChildExhibits, ref cntTimelines, ref cntExhibits); } } } }