public SpectrumPanel(SignalManager manager, TransformManager transformer) { signal = manager; spectrum = transformer; view = new SpectrumViewManager(spectrum.GetSpectrum()); options = new OptionsPanel(spectrum); Controls.Add(options); Controls.Add(view); Update(); spectrum.Retransformed += () => { Update(); }; SizeChanged += (sender, ev) => { var chartSize = Math.Min(Width, Height * 70 / 100); view.Size = new Size(chartSize, chartSize); options.SetBounds(0, chartSize + 25, Width, Math.Max(250, Height / 4)); view.Invalidate(); }; }
private Panel GetSignalFrame(SignalManager manager, SinGenerator signal, int i) { var frame = new Panel { BorderStyle = BorderStyle.FixedSingle, Height = frameHeight, Width = Width - 20 }; var delButton = new Button { Dock = DockStyle.Bottom, Text = "Удалить" }; delButton.Click += (sender, ev) => { new SignalDeleteConfirm(manager, signal).ShowDialog(); }; var formula = new Label { Dock = DockStyle.Top, Text = manager.Signals[i].GetTextFormula(), Font = new Font("Arial", 10) }; frame.Controls.Add(formula); frame.Controls.Add(delButton); Controls.Add(frame); return(frame); }
public SignalsList(SignalManager manager) : base() { Height = (manager.Signals.Count + 1) * frameHeight + 50; FlowDirection = FlowDirection.LeftToRight; //ScrollBar scroll = new VScrollBar(); //scroll.Dock = DockStyle.Right; //scroll.Scroll += (sender, ev) => //{ // VerticalScroll.Value = scroll.Value; //}; manager.AddedSignal += (sin, index) => { Controls.Remove(addButton); Controls.Add(GetSignalFrame(manager, sin, index)); Controls.Add(addButton); }; manager.DeletedSignal += (values, index) => { Controls.RemoveAt(index); }; addButton = GetAddButton(manager); for (var i = 0; i < manager.Signals.Count; i++) { var j = i; var signalFrame = GetSignalFrame(manager, manager.Signals[i], j); } Controls.Add(addButton); //Controls.Add(scroll); }
public SpectrumVisorForm() : base() { Width = 1000; Height = 800; var signal = new SignalManager(10, 1024); signal.AddSignalBySize(0, 1024, 0, 1.0 / 256, 10, 0, 0); //signal.AddSignalBySize(0, 1024, 0, 1.0 / 64, 5, 0, 0); //signal.AddSignalBySize(0, 1024, 0, 1.0 / 32, 1, 5, 0); var transform = new TransformManager(new WindowedFourier(128), signal); signalPanel = new SignalPanel(signal); signalPanel.MaximumSize = new Size(400, 600); spectrumPanel = new SpectrumPanel(signal, transform); Controls.Add(signalPanel); Controls.Add(spectrumPanel); Load += (sender, ev) => OnSizeChanged(EventArgs.Empty); SizeChanged += (sender, ev) => { signalPanel.Size = new Size(Width * 40 / 100, Height - 100); spectrumPanel.SetBounds(Width * 45 / 100, 0, Width / 2, Height - 100); }; }
public SignalDeleteConfirm(SignalManager manager, SinGenerator signal) { MaximumSize = new Size(400, 300); MinimumSize = new Size(400, 300); var message = new Label { Width = 250, Text = "Вы уверены что хотите удалить сигнал " + signal.GetTextFormula() + " из списка сигналов.", Location = new Point(50, 100) }; var okButton = new Button { Location = new Point(100, 150), Text = "Да" }; okButton.Click += (sender, ev) => { manager.DeleteSignal(signal); Close(); }; var cancelButton = new Button() { Location = new Point(200, 150), Text = "Нет" }; cancelButton.Click += (sender, ev) => { Close(); }; Controls.Add(message); Controls.Add(okButton); Controls.Add(cancelButton); }
public AddSignalDialog(SignalManager signals) { //фиксирование размеров Width = 400; Height = 600; FormBorderStyle = FormBorderStyle.FixedDialog; name = "no_name"; start = 0; dur = signals.Size; mult = 1; freq = 8 / dur; c = 0; var table = new TableLayoutPanel(); table.RowStyles.Add(new RowStyle(SizeType.Percent, 25)); table.RowStyles.Add(new RowStyle(SizeType.Percent, 25)); table.RowStyles.Add(new RowStyle(SizeType.Percent, 25)); table.RowStyles.Add(new RowStyle(SizeType.Percent, 25)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); table.Controls.Add(InitStartField(), 0, 0); table.Controls.Add(InitDurField(), 0, 1); table.Controls.Add(new Panel(), 0, 2); table.Controls.Add(InitFreqField(), 1, 0); table.Controls.Add(InitMultField(), 1, 1); table.Controls.Add(InitConstField(), 1, 2); var okButton = new Button { Text = "Создать" }; okButton.Click += (sender, ev) => { signals.AddSignalBySize((int)start, (int)dur, 0, freq, mult, c, 0); }; table.Controls.Add(okButton, 0, 3); var cancelButton = new Button { Text = "Отмена" }; cancelButton.Click += (sender, ev) => { Close(); }; table.Controls.Add(cancelButton, 1, 3); table.Dock = DockStyle.Fill; Controls.Add(table); }
public SignalViewState(SignalManager manager, SignalViewType current) { views = new Dictionary <SignalViewType, ISignalsVisualizer>(); SetView(new AloneVisualizer(manager.Sum), SignalViewType.Summarized); SetView(new ManagerVisualizer(manager), SignalViewType.Divided); var divided = new List <SignalViewOptions>(); CurrentType = current; }
private Button GetAddButton(SignalManager manager) { var button = new Button { Height = frameHeight - 10, Width = Width - 20, Text = "Добавить" }; button.Click += (sender, ev) => { var creatingDialog = new AddSignalDialog(manager).ShowDialog(); }; return(button); }
public ManagerVisualizer(SignalManager manager) { options = new List <SignalViewOptions>(); options.AddRange(manager.Signals.Select((s) => new SignalViewOptions(s))); //manager.AddedSignal += (signal) => { options.Add(new SignalViewOptions(signal)); }; //manager.DeletedSignal += (signal) => { // for (var i = 0; i < options.Count; i++) // if (options[i].Signal.Equals(signal)) // { // options.RemoveAt(i); // break; // } //}; }
public SignalPanel(SignalManager signals) : base() { signalState = signals; viewType = SignalViewType.Signals; signalViewes = new Dictionary <SignalViewType, Chart>(); InitCharts(); currentView = signalViewes[viewType]; signalsList = new SignalsList(signals); viewSwitchButton = new Button(); viewSwitchButton = GetSwitchButton(); Reconstruct(); signals.AddedSignal += (values, index) => { Reconstruct(); Invalidate(); }; signals.DeletedSignal += (values, index) => { Reconstruct(); Invalidate(); }; Controls.Add(currentView); Controls.Add(viewSwitchButton); Controls.Add(signalsList); SizeChanged += (sender, ev) => { currentView.SetBounds(0, 0, Height / 2, Height / 2); viewSwitchButton.Location = new Point(currentView.Width - viewSwitchButton.Width, currentView.Height); var listPrefs = signalsList.PreferredSize; signalsList.SetBounds(0, currentView.Height + viewSwitchButton.Height, listPrefs.Width, listPrefs.Height); }; }
public TransformManager(ITransformer transform, SignalManager sign) { transformer = transform; signal = sign; norm = new SignalNormalizer(); FreqSize = 16; StartFreq = 1; FreqStep = 1; sign.AddedSignal += (values, index) => { UpdateSpectrum(); }; sign.DeletedSignal += (values, index) => { UpdateSpectrum(); }; spectrum = new FreqPoint[0][]; UpdateSpectrum(); }
public SignalViewState(SignalManager manager) : this(manager, DEFAULT_VIEW) { }
public SumSignal(SignalManager main) { manager = main; }
public TransformManager(SignalManager sign) { transformers = new Dictionary <TransformType, ITransformer> {
public SignalController(int size) { Internal = new SignalManager(size); View = new SignalViewState(Internal); }