Scenes/FunctionScene.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace SciencePad.Scenes
{
    public abstract class FunctionScene : CoordinateScene
    {
        #region 属性

        public ObservableCollection<IFunction> FunctionList { get; private set; }

        #endregion

        #region 构造方法

        public FunctionScene()
        {
            this.FunctionList = new ObservableCollection<IFunction>();
            this.FunctionList.CollectionChanged += this.FunctionList_CollectionChanged;
        }

        #endregion

        #region 抽象方法

        public abstract Geometry CreateFunctionGeometry(IFunction function);

        #endregion

        #region 重写方法

        protected override void OnRender(DrawingContext dc)
        {
            base.OnRender(dc);

            foreach (IFunction function in this.FunctionList)
            {
                this.DrawFunction(function, dc);
            }
        }

        #endregion

        #region 实例方法

        private void DrawFunction(IFunction function, DrawingContext dc)
        {
            Geometry funcGeometry = this.CreateFunctionGeometry(function);

            dc.DrawGeometry(null, function.LinePen, funcGeometry);
        }

        #endregion

        #region 事件处理器
后面还有 9 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。