/// <summary> /// Annotates the specified isoline collection. /// </summary> /// <param name="collection">The collection.</param> /// <param name="visible">The visible rectangle.</param> /// <returns></returns> public Collection <IsolineTextLabel> Annotate(IsolineCollection collection, Rect visible) { Collection <IsolineTextLabel> res = new Collection <IsolineTextLabel>(); foreach (var line in collection.Lines) { double way = 0; foreach (var segment in line.GetSegments()) { double length = segment.GetLength(); way += length; if (way > wayBeforeText) { way = 0; res.Add(new IsolineTextLabel { Text = line.RealValue.ToString("G2"), Position = segment.Max, Rotation = (segment.Max - segment.Min).ToAngle() }); } } } return(res); }
/// <summary> /// This method is called when data source changes. /// </summary> protected virtual void UpdateDataSource() { if (dataSource != null) { IsolineBuilder.DataSource = dataSource; collection = IsolineBuilder.Build(); } else { collection = null; } }
/// <summary> /// Builds isoline data for the specified level in 2d scalar field. /// </summary> /// <param name="level">The level.</param> /// <returns></returns> public IsolineCollection Build(double level) { VerifyDataSource(); minMax = dataSource.GetMinMax(); values = dataSource.Data; segments = new IsolineCollection(); PrepareCells(level); return(segments); }
/// <summary> /// Builds isoline data by 2d scalar field containing in data source. /// </summary> /// <returns>Collection of data describing built isolines</returns> public IsolineCollection Build() { VerifyDataSource(); minMax = dataSource.GetMinMax(); values = dataSource.Data; double[] levels = GetLevelsForIsolines(); segments = new IsolineCollection(); foreach (double level in levels) { PrepareCells(level); } return(segments); }