public static List <Relation> RelationsOn(DateTimeOffset date) { List <Position> positions = CurrentEphemeris[date]; List <Relation> allRelations = new List <Relation>(); Position superiorPos, inferiorPos; Angle distance; Aspects aspect; for (int i = Masters.Count - 1; i > 0; i--) { PlanetId superiorId = Masters[i]; superiorPos = CurrentEphemeris.PositionOf(positions, superiorId); for (int j = i - 1; j >= 0; j--) { PlanetId inferiorId = Masters[j]; inferiorPos = CurrentEphemeris.PositionOf(positions, inferiorId); distance = inferiorPos.Longitude - superiorPos.Longitude; aspect = Aspects.CurrentAspectOf(distance); if (aspect != null) { allRelations.Add(new Relation(date, superiorPos, inferiorPos)); } } } return(allRelations); }
private void setDuration(ZedGraphControl zed, DateTimeOffset since, DateTimeOffset until) { double min = zed.GraphPane.XAxis.Scale.Min = since.DateTime.ToOADate(); double max = zed.GraphPane.XAxis.Scale.Max = until.DateTime.ToOADate(); List <SeFlg> centricFlags = new List <SeFlg> { SeFlg.GEOCENTRIC, SeFlg.HELIOCENTRIC }; List <double> xValues = new List <double>(); for (double x = min; x <= max; x++) { xValues.Add(x); } for (int i = zed.GraphPane.CurveList.Count - 1; i >= 0; i--) { CurveItem curve = zed.GraphPane.CurveList[i]; removeCurve(zedLongTerm, curve); } foreach (SeFlg flag in centricFlags) { CentricFlag = flag; #region Get the longitude curves OrbitsDict = CurrentEphemeris.AllOrbitsCollectionDuring(since, until); TheAspectarian = CurrentEphemeris.AspectarianDuring(since, until, defaultAspectImportance); //populateAspectarian(TheAspectarian); //Special treatment of average longDif by replacing them with the smoothed version without gap generated when a planet enters Aries for (int i = CurrentEphemeris.Luminaries.IndexOf(PlanetId.Five_Average); i < CurrentEphemeris.Luminaries.Count; i++) { PlanetId id = CurrentEphemeris.Luminaries[i]; List <double> beforeShift = OrbitsDict[PositionValueIndex.Longitude][id]; List <double> afterShift = Ephemeris.SmoothingOfAverage(beforeShift); OrbitsDict[PositionValueIndex.Longitude].Remove(id); OrbitsDict[PositionValueIndex.Longitude].Add(id, afterShift); } #endregion Curves.Clear(); foreach (KeyValuePair <PlanetId, List <double> > kvp in OrbitsDict[PositionValueIndex.Longitude]) { String name = Planet.Glyphs[kvp.Key].ToString(); Color color = Planet.PlanetsColors.ContainsKey(kvp.Key) ? Planet.PlanetsColors[kvp.Key].First() : Color.Gray; LineItem line = null; List <IPlanetEvent> signChanges = CurrentEphemeris[since, until, PlanetEventFlag.SignChangedCategory, kvp.Key]; if (signChanges != null && signChanges.Count != 0) { List <double> finalYs = new List <double>(kvp.Value); List <double> finalXs = new List <double>(xValues); for (int i = signChanges.Count - 1; i >= 0; i--) { SignEntrance change = signChanges[i] as SignEntrance; double x = (change.When - since).TotalDays; double y = Math.Round(change.Where.Longitude); int insertPos = (int)x + 1; if (y != 0 && y != 360) { finalXs.Insert(insertPos, x + min); finalYs.Insert(insertPos, y); } else { finalXs.Insert(insertPos, x + min); finalXs.Insert(insertPos, x + min); finalYs.Insert(insertPos, change.IsRetrograde ? 360 : 0); finalYs.Insert(insertPos, change.IsRetrograde ? 0 : 360); } } line = new LineItem(name, finalXs.ToArray(), finalYs.ToArray(), color, SymbolType.None); } else { line = new LineItem(name, xValues.ToArray(), kvp.Value.ToArray(), color, SymbolType.None); } Curves.Add(kvp.Key, new Dictionary <int, CurveItem> { { 0, line } }); } getEventCurves(); } }