Ejemplo n.º 1
0
        public override void Redraw()
        {
            int    NIL  = CountNumberInLine();
            double fn_L = CountFirstNeuronLeftPos();
            double fn_T = CountFirstNeuronTopPos();
            double pS   = CountPixelSize();


            for (int i = 0; i < neurons.Count; i++)
            {
                Canvas.SetLeft(neurons[i].Representation, fn_L + (i % NIL) * pS);
                Canvas.SetTop(neurons[i].Representation, fn_T + (i / NIL) * pS);

                neurons[i].SetSize(pS);

                if (GetSetting(NumberRepresentationSettings.IsWhiteBlack) == 0)
                {
                    neurons[i].ColorType = ScreenNeuron.ColorTypes.GreenRed;
                }
                else
                {
                    neurons[i].ColorType = ScreenNeuron.ColorTypes.WhiteBlack;
                }
            }
            OnRedrawing?.Invoke(this, null);
        }
Ejemplo n.º 2
0
        public override void Redraw()
        {
            var neuronsOnScreen     = GetSetting(NumberRepresentationSettings.NeuronsOnScreen);
            var spaces              = GetSetting(NumberRepresentationSettings.Spaces);
            var firstNeuronOnScreen = GetSetting(NumberRepresentationSettings.FirstNeuronOnScreen);

            double horizontalPos;
            double firstNeuronPos = CountFirstNeuronPos();
            double neuronSize     = CountNeuronSize();

            for (int i = 0; i < neurons.Count; i++)
            {
                layerScreen.Children.Remove(neurons[i].Representation);
            }

            for (int i = 0; i < neuronsOnScreen; i++)
            {
                if (i == neurons.Count)
                {
                    break;
                }

                horizontalPos = firstNeuronPos + i * (spaces + neuronSize);

                Canvas.SetLeft(neurons[i + (int)firstNeuronOnScreen].Representation, horizontalPos);
                Canvas.SetTop(neurons[i + (int)firstNeuronOnScreen].Representation, (layerScreen.Height - neuronSize) / 2);

                layerScreen.Children.Add(neurons[i + (int)firstNeuronOnScreen].Representation);
                neurons[i + (int)firstNeuronOnScreen].SetSize(neuronSize);

                if (GetSetting(NumberRepresentationSettings.IsWhiteBlack) == 0)
                {
                    neurons[i + (int)firstNeuronOnScreen].ColorType = ScreenNeuron.ColorTypes.GreenRed;
                }
                else
                {
                    neurons[i + (int)firstNeuronOnScreen].ColorType = ScreenNeuron.ColorTypes.WhiteBlack;
                }
            }

            OnRedrawing?.Invoke(this, null);
        }