コード例 #1
0
ファイル: IsolineTextAnnotater.cs プロジェクト: simple689/WPF
        /// <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);
        }
コード例 #2
0
ファイル: IsolineGraphBase.cs プロジェクト: simple689/WPF
 /// <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;
     }
 }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <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);
        }