Пример #1
0
 def addLine(self, _from, to):
     line = Line()
     line.X1 = _from[0]
     line.Y1 = _from[1]
     line.X2 = to[0]
     line.Y2 = to[1]
     line.Stroke = Brushes.White
     line.StrokeThickness = 2.0
     self.canvas.Children.Add(line)
Пример #2
0
 def addLine(self, _from, to):
     line = Line()
     line.X1 = _from[0]
     line.Y1 = _from[1]
     line.X2 = to[0]
     line.Y2 = to[1]
     line.Stroke = SolidColorBrush(Color.FromArgb(255, 255, 255,
                                                  255))  # Brushes.White
     line.StrokeThickness = 2.0
     self.canvas.Children.Add(line)
Пример #3
0
def line(x1, y1, x2, y2, widget):
    line = Line()
    line.Stroke = SolidColorBrush(Colors.Blue)
    line.X1 = float(x1)
    line.X2 = float(x2)
    line.Y1 = float(y1)
    line.Y2 = float(y2)
    widget.Children.Add(line)
Пример #4
0
 def addLine(self, _from, to):
     line = Line()
     line.X1 = _from[0]
     line.Y1 = _from[1]
     line.X2 = to[0]
     line.Y2 = to[1]
     line.Stroke = SolidColorBrush(Color.FromArgb(255,255,255,255)) # Brushes.White
     line.StrokeThickness = 2.0
     self.canvas.Children.Add(line)
Пример #5
0
 def addLine(self, _from, to):
     line = Line()
     line.X1 = _from[0]
     line.Y1 = _from[1]
     line.X2 = to[0]
     line.Y2 = to[1]
     line.Stroke = Brushes.White
     line.StrokeThickness = 2.0
     self.canvas.Children.Add(line)
 def draw_layers_connections(self, brain, first_layer_index, second_layer_index, neuron_size):
     first_layer_margin = (self.canvas.ActualWidth - len(brain.layers[first_layer_index]) * neuron_size) / (len(brain.layers[first_layer_index]) + 1)
     second_layer_margin = (self.canvas.ActualWidth - len(brain.layers[second_layer_index]) * neuron_size) / (len(brain.layers[second_layer_index]) + 1)
     for second_layer_neuron_index, second_layer_neuron in enumerate(brain.layers[second_layer_index]):
         for first_layer_neuron_index, first_layer_neuron in enumerate(brain.layers[first_layer_index]):
             line = Line()
             line.X1 = second_layer_margin + second_layer_neuron_index * (neuron_size + second_layer_margin) + neuron_size / 2.0
             line.Y1 = second_layer_index * neuron_size * 2.0 + neuron_size / 2.0
             line.X2 = first_layer_margin + first_layer_neuron_index * (neuron_size + first_layer_margin) + neuron_size / 2.0
             line.Y2 = first_layer_index * neuron_size * 2.0 + neuron_size / 2.0
             line.StrokeThickness = 2
             line.Stroke = SolidColorBrush(get_color(second_layer_neuron.w[first_layer_neuron_index]))
             self.canvas.AddChild(line)
Пример #7
0
 def __init__(self, xpos, ypos, length, direction):
     self.xpos = xpos
     self.ypos = ypos
     self.length = length
     self.direction = direction
     self.xdir = direction[0]
     self.ydir = direction[1]
     self.destroyed = False
     self.edges = self.get_edges()
     self.shape = Line()
     self.shape.Stroke = SolidColorBrush(Colors.Black)
     self.shape.X1 = 0
     self.shape.Y1 = 0
     if direction in (Direction.LEFT, Direction.RIGHT):
         self.shape.X2 = self.length
         self.shape.Y2 = 0
     else:
         self.shape.X2 = 0
         self.shape.Y2 = self.length
     self.shape.StrokeThickness = 1
Пример #8
0
 def draw_layers_connections(self, brain, first_layer_index,
                             second_layer_index, neuron_size):
     first_layer_margin = (
         self.canvas.ActualWidth - len(brain.layers[first_layer_index]) *
         neuron_size) / (len(brain.layers[first_layer_index]) + 1)
     second_layer_margin = (
         self.canvas.ActualWidth - len(brain.layers[second_layer_index]) *
         neuron_size) / (len(brain.layers[second_layer_index]) + 1)
     for second_layer_neuron_index, second_layer_neuron in enumerate(
             brain.layers[second_layer_index]):
         for first_layer_neuron_index, first_layer_neuron in enumerate(
                 brain.layers[first_layer_index]):
             line = Line()
             line.X1 = second_layer_margin + second_layer_neuron_index * (
                 neuron_size + second_layer_margin) + neuron_size / 2.0
             line.Y1 = second_layer_index * neuron_size * 2.0 + neuron_size / 2.0
             line.X2 = first_layer_margin + first_layer_neuron_index * (
                 neuron_size + first_layer_margin) + neuron_size / 2.0
             line.Y2 = first_layer_index * neuron_size * 2.0 + neuron_size / 2.0
             line.StrokeThickness = 2
             line.Stroke = SolidColorBrush(
                 get_color(second_layer_neuron.w[first_layer_neuron_index]))
             self.canvas.AddChild(line)