Пример #1
0
        private void RunVisualizer(object sender, EventArgs e)
        {
            var visualizer = new BubbleSortVisualizer(this);
            this.Visible = false;

            var data = new Data(visualizer);
            data.Show();
        }
Пример #2
0
        static Diagram CreateDiagram(Viewport viewport, Drawer drawer, Data.Timer timer, Parameters parameters)
        {
            Diagram diagram = new Diagram();

            diagram.Graphs = new List<Graph>();

            diagram.GraphSettings = new GraphSettings();
            if (parameters.ExtendGraphs != null) diagram.GraphSettings.ExtendGraphs = parameters.ExtendGraphs.Value;
            if (parameters.LineWidth != null) diagram.GraphSettings.LineWidth = parameters.LineWidth.Value;

            switch (parameters.TimeManagerType)
            {
                case TimeManagerType.Continuous:
                    diagram.TimeManager = new ContinuousTimeManager(timer);
                    break;
                case TimeManagerType.Shiftting:
                    diagram.TimeManager = new ShiftingTimeManager(timer);
                    if (parameters.TimeManagerParameter != null) ((ShiftingTimeManager)diagram.TimeManager).ShiftLength = parameters.TimeManagerParameter.Value;
                    break;
                case TimeManagerType.Wrapping:
                    diagram.TimeManager = new WrappingTimeManager(timer);
                    if (parameters.TimeManagerParameter != null) ((WrappingTimeManager)diagram.TimeManager).GapLength = parameters.TimeManagerParameter.Value;
                    break;
                default: throw new InvalidOperationException();
            }
            if (parameters.DiagramWidth != null) diagram.TimeManager.Width = parameters.DiagramWidth.Value;

            switch (parameters.ValueManagerType)
            {
                case ValueManagerType.Fitting:
                    diagram.ValueManager = new FittingValueManager(diagram);
                    break;
                case ValueManagerType.Fixed:
                    diagram.ValueManager = new FixedValueManager();
                    if (parameters.ValueRange != null) ((FixedValueManager)diagram.ValueManager).FixedRange = parameters.ValueRange.Value;
                    break;
                default: throw new InvalidOperationException();
            }

            diagram.DataManager = new PerPixelDataManager(diagram);
            if (parameters.ClearData != null) diagram.DataManager.ClearData = parameters.ClearData.Value;

            diagram.AxisX = new AxisX(drawer, diagram);
            if (parameters.MarkerCountX != null) diagram.AxisX.MarkerCount = parameters.MarkerCountX.Value;
            if (parameters.DiagramColor != null) diagram.AxisX.Color = parameters.DiagramColor.Value;

            diagram.AxisY = new AxisY(drawer, diagram);
            if (parameters.MarkerCountY != null) diagram.AxisY.MarkerCount = parameters.MarkerCountY.Value;
            if (parameters.DiagramColor != null) diagram.AxisY.Color = parameters.DiagramColor.Value;

            diagram.Layouter = new Layouter(viewport, diagram.AxisX, diagram.AxisY);

            return diagram;
        }
Пример #3
0
 public BubbleSortAutomate(int[] array)
 {
     data = new Data(array);
     stack = new Stack<object>();
 }