public void DrawData(TSOM SOM, TX[] XX) { double[,] Data = new double[M, M]; for (int i = 0; i < M; i++) { for (int j = 0; j < M; j++) { Data[i, j] = 0; } } double max = 0; for (int k = 0; k < XX.Count(); k++) { double min = double.MaxValue; int ind = -1; for (int n = 0; n < SOM.Count; n++) { double d = SOM[n].R(XX[k].x); if (d < min) { min = d; ind = n; } } int[] ij = SOM.Get_ij(ind); Data[ij[0], ij[1]] += 1; if (Data[ij[0], ij[1]] > max) { max = Data[ij[0], ij[1]]; } } Brush br; double L = g.Width; double dl = L / M; for (int i = 0; i < M; i++) { for (int j = 0; j < M; j++) { if (Data[i, j] == 0) { continue; } br = Brushes.White; //GetColor(Data[i, j] / max); Ellipse O = new Ellipse(); O.Stroke = br; O.Fill = br; O.Width = dl; O.Height = dl; O.Margin = new Thickness(i * dl, j * dl, 0, 0); g.Children.Add(O); } } }
private void cmCheck(object sender, RoutedEventArgs e) { string s = textBox.Text; string[] ss = s.Split('\t'); int Ns = ss.Count(); if (Ns != N) { return; } TX X = new TX(N, s, null); for (int i = 0; i < N; i++) { try { X.x[i] = Convert.ToDouble(ss[i]); } catch { return; } } X.Normalize(Filer.Maxs); double min = double.MaxValue; int ind = -1; for (int n = 0; n < SOM.Count; n++) { double d = SOM[n].R(X.x); if (d < min) { min = d; ind = n; } } int[] ij = SOM.Get_ij(ind); Brush br = Brushes.Black; if (radioButton.IsChecked == true) { br = Brushes.Black; } if (radioButton1.IsChecked == true) { br = Brushes.Blue; } if (radioButton2.IsChecked == true) { br = Brushes.Red; } if (radioButton3.IsChecked == true) { br = Brushes.Green; } if (radioButton4.IsChecked == true) { br = Brushes.Yellow; } if (radioButton5.IsChecked == true) { br = Brushes.Orange; } Map.DrawCheck(br, ij[0], ij[1]); }