Exemple #1
0
        private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            AddEllipse(Cnva, e.GetPosition(Cnva).X, e.GetPosition(Cnva).Y, Color.FromRgb(214, 195, 175));
            Cnva.UpdateLayout();

            this._points.Add(e.GetPosition(Cnva));
        }
Exemple #2
0
        private void BtnReset_Click(object sender, RoutedEventArgs e)
        {
            Cnva.Children.Clear();
            Cnva.UpdateLayout();

            this._nbClusterOnScreen = 0;
            this._nbIteration       = 0;
            this._points            = new List <Point>();
            this._centroid          = new List <Point>();
            TbClusterNb.Text        = "0";
        }
Exemple #3
0
        private void Canvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (_nbClusterOnScreen < MAX_CLUSTERS)
            {
                AddTriangle(Cnva, e.GetPosition(Cnva).X, e.GetPosition(Cnva).Y, this._clusterColor[this._nbClusterOnScreen]);
                Cnva.UpdateLayout();
                _nbClusterOnScreen++;

                this._centroid.Add(e.GetPosition(Cnva));
            }

            if (TbClusterNb.Text == "" || int.Parse(TbClusterNb.Text) < _nbClusterOnScreen)
            {
                TbClusterNb.Text = "" + _nbClusterOnScreen;
            }
        }
Exemple #4
0
        private void updateCanvas(Instances instances, Instances centroids)
        {
            Cnva.Children.Clear();

            foreach (var instance in instances.DataSet)
            {
                this.AddEllipse(
                    Cnva,                                                         // canvas
                    instance.Attributes[0].DoubleValue,                           // x
                    instance.Attributes[1].DoubleValue,                           // y
                    this._clusterColor[(int)instance.Attributes[2].DoubleValue]); // color
            }

            foreach (var centroid in centroids.DataSet)
            {
                this.AddTriangle(
                    Cnva,                               // canvas
                    centroid.Attributes[0].DoubleValue, // x
                    centroid.Attributes[1].DoubleValue, // y
                    this._clusterColor[(int)centroid.Attributes[2].DoubleValue]);
            }
            Cnva.UpdateLayout();
        }