示例#1
0
文件: edge.py 项目: andrsd/schematics
  def __init__(self, tail, head, **kwargs):
    self.tail = tail
    self.head = head
    self.directional = process_directional(True, kwargs)

    if self.tail == self.head:
      sys.exit('Error: Cannot connect a node to itself. (' + str(self.tail) + ' -/-> ' + str(self.head) + ')')

    if self.directional:
      self.string_connector = " --> "
    else:
      self.string_connector = " --- "

    self.label_location = process_label_location('top', kwargs)
    self.label_shift = process_label_shift(0.0, kwargs)
    super(Edge, self).__init__(Point(0.0, 0.0), ll = self.label_location, **kwargs)

    self.reflect = process_reflect(None, kwargs)
    self.angle = None

    # Arrow property processing option
    self.edge_width = process_width(0.025, kwargs)
    self.head_width_to_edge_width = process_head_width_to_width(3.0, kwargs)
    self.head_length_to_head_width = process_head_length_to_head_width(2.0, kwargs)
    self.overhang = process_overhang(0.0, kwargs)
    self.alpha = process_alpha(1.0, kwargs)
    self.face_color = process_face_color((0.0, 0.0, 0.0), kwargs)

    self.draw_bool = process_draw(True, kwargs)
    self.draw_label_bool = process_draw_label(True, kwargs)

    self._instances[id(self)] = self
示例#2
0
    def __init__(self, x=0.0, y=0.0, **kwargs):
        self.radius = process_radius(0.05, kwargs)
        self.line_width = process_line_width(1.5, kwargs)
        self.face_color = process_face_color((1.0, 1.0, 1.0), kwargs)
        self.alpha = process_alpha(1.0, kwargs)
        self.edge_color = process_edge_color((0.0, 0.0, 0.0), kwargs)

        Label.__init__(self, Point(x, y), **kwargs)
        super(Node, self).__init__(x, y)

        self.draw_bool = process_draw(True, kwargs)
        self.draw_label_bool = process_draw_label(True, kwargs)

        self._instances[id(self)] = self
示例#3
0
文件: node.py 项目: andrsd/schematics
  def __init__(self, x = 0.0, y = 0.0, **kwargs):
    self.radius = process_radius(0.05, kwargs)
    self.line_width = process_line_width(1.5, kwargs)
    self.face_color = process_face_color((1.0, 1.0, 1.0), kwargs)
    self.alpha = process_alpha(1.0, kwargs)
    self.edge_color = process_edge_color((0.0, 0.0, 0.0), kwargs)


    Label.__init__(self, Point(x, y), **kwargs)
    super(Node, self).__init__(x, y)

    self.draw_bool = process_draw(True, kwargs)
    self.draw_label_bool = process_draw_label(True, kwargs)

    self._instances[id(self)] = self
示例#4
0
    def __init__(self, tail, head, **kwargs):
        self.tail = tail
        self.head = head
        self.directional = process_directional(True, kwargs)

        if self.tail == self.head:
            sys.exit('Error: Cannot connect a node to itself. (' +
                     str(self.tail) + ' -/-> ' + str(self.head) + ')')

        if self.directional:
            self.string_connector = " --> "
        else:
            self.string_connector = " --- "

        self.label_location = process_label_location('top', kwargs)
        self.label_shift = process_label_shift(0.0, kwargs)
        super(Edge, self).__init__(Point(0.0, 0.0),
                                   ll=self.label_location,
                                   **kwargs)

        self.reflect = process_reflect(None, kwargs)
        self.angle = None

        # Arrow property processing option
        self.edge_width = process_width(0.025, kwargs)
        self.head_width_to_edge_width = process_head_width_to_width(
            3.0, kwargs)
        self.head_length_to_head_width = process_head_length_to_head_width(
            2.0, kwargs)
        self.overhang = process_overhang(0.0, kwargs)
        self.alpha = process_alpha(1.0, kwargs)
        self.face_color = process_face_color((0.0, 0.0, 0.0), kwargs)

        self.draw_bool = process_draw(True, kwargs)
        self.draw_label_bool = process_draw_label(True, kwargs)

        self._instances[id(self)] = self