/* constructor */ public MainFrame(SignalFilter filter) { InitializeComponent(); this.filter = filter; stepNrString = stepNr.Text; simModeCombo.SelectedIndex = 0; chosenCaseCombo.SelectedIndex = 0; weightsCombo.SelectedIndex = 0; netSize = 0; ready = false; simInProgress = false; initial = true; reseted = false; shifted = false; dataNoisy = new ListDataSeries(netSize); dataNoisy.LineWidth = 2f; dataNoisy.ForeColor = Color.DarkGray; dataNoisy.AntiAlias = true; dataClean = new ListDataSeries(netSize); dataClean.LineWidth = 2f; dataClean.ForeColor = Color.Green; dataClean.AntiAlias = true; dataProcessed = new ListDataSeries(netSize); dataProcessed.LineWidth = 2f; dataProcessed.ForeColor = Color.Blue; dataProcessed.AntiAlias = true; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SignalFilter signalFilter = new SignalFilter(); Application.Run(); }
/* called when new network is created */ public void refresh(SignalFilter filter, bool netRefresh) { if (netRefresh) /* network has changed */ { this.filter = filter; netSize = filter.getValue(SignalFilter.SIZE); stepsNr = filter.getValue(SignalFilter.STEPS); step = 20f / (float)(netSize - 1); /* setup display data */ prepareDisplayData(CLEAN_AND_NOISY); } input = filter.getInput(); }
/* simulation case (shifted/standard) combo box's event listener */ private void chosenCaseCombo_SelectedIndexChanged(object sender, EventArgs e) { if (!simInProgress) /* simulation is not running */ { if (chosenCaseCombo.SelectedIndex == 1) /* shifted mode chosen */ { if (!shifted) /* plot has not been shifted yet */ { plotArea.DataSeries.Remove(dataClean); plotArea.DataSeries.Remove(dataNoisy); filter.setCoefficent(SignalFilter.SHIFTED); prepareDisplayData(CLEAN_AND_NOISY); if (noisyCheckBox.Checked && !plotArea.DataSeries.Contains(dataNoisy)) { plotArea.DataSeries.Add(dataNoisy); } if (cleanCheckBox.Checked && !plotArea.DataSeries.Contains(dataClean)) { plotArea.DataSeries.Add(dataClean); } plotArea.Update(); } } else /* standard mode chosen */ { if (shifted) /* plot has already been shifted */ { filter = filter.shiftBackData(); filter.setCoefficent(SignalFilter.STANDARD); plotArea.DataSeries.Remove(dataClean); plotArea.DataSeries.Remove(dataNoisy); prepareDisplayData(CLEAN_AND_NOISY); if (noisyCheckBox.Checked && !plotArea.DataSeries.Contains(dataNoisy)) { plotArea.DataSeries.Add(dataNoisy); } if (cleanCheckBox.Checked && !plotArea.DataSeries.Contains(dataClean)) { plotArea.DataSeries.Add(dataClean); } plotArea.Update(); } } } }
/* constructor*/ public InputFrame(SignalFilter filter) { /* get the reference to the main class's instance */ this.filter = filter; InitializeComponent(); }