public override void SortAndAssignNeighbours() { if (BeforeBuildingCurves != null) { BeforeBuildingCurves(this, null); } base.SortAndAssignNeighbours(); Curves.Clear(); if (Keyframes.Count > 0) { //first curve Curves.Add(new TLCurve("Start" + IDGenerator.NewID, null, Keyframes[0])); //between for (int i = 1; i < Keyframes.Count; i++) { Curves.Add(new TLCurve(IDGenerator.NewID, Keyframes[i - 1], Keyframes[i])); } //last Curves.Add(new TLCurve("End" + IDGenerator.NewID, Keyframes[Keyframes.Count - 1], null)); } if (AfterBuildingCurves != null) { AfterBuildingCurves(this, null); } }
/// <summary> /// Clears the geometry of the base-line, which is no longer needed /// </summary> internal void ClearGeometry() { _isCleared = true; if (Curves != null) { Curves.Clear(); } }
public void ClearAll() { hanldeCollectionChanges = false; try { Curves.Clear(); addedCurves.Clear(); removedCurves.Clear(); } finally { hanldeCollectionChanges = true; } }
public void UpdatePropertiesFrom(IUpdatable source, ICloneManager cloneManager) { var sourceChartTemplate = source as CurveChartTemplate; if (sourceChartTemplate == null) { return; } FontAndSize.UpdatePropertiesFrom(sourceChartTemplate.FontAndSize, cloneManager); ChartSettings.UpdatePropertiesFrom(sourceChartTemplate.ChartSettings, cloneManager); Name = sourceChartTemplate.Name; _axes.Clear(); Curves.Clear(); sourceChartTemplate.Axes.Each(axis => AddAxis(axis.Clone())); sourceChartTemplate.Curves.Each(curve => Curves.Add(cloneManager.Clone(curve))); IsDefault = sourceChartTemplate.IsDefault; PreviewSettings = sourceChartTemplate.PreviewSettings; }
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(); } }