Exemplo n.º 1
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
Exemplo n.º 2
0
  def __init__(self, center_of_rotation, **kwargs):
    super(Label, self).__init__(center_of_rotation, **kwargs)

    self._get_label_locations()
    self.label_location = process_label_location('center', kwargs)
    self.label_string = process_label_string(None, kwargs)
    self.label_angle = process_label_angle(0.0, kwargs)
    self.label_pad = process_label_pad(1.0, kwargs)
    self.font_size = process_font_size(12, kwargs)
    self.label = None
Exemplo n.º 3
0
 def __init__(self, junction_edges, **kwargs):
   self.junction_edges = junction_edges
   self.label_edge_number = process_label_edge_number(0, kwargs)
   self.labeled_edge = self.junction_edges[self.label_edge_number]
   self.label_location = process_label_location('top', kwargs)
   self.label_shift = process_label_shift(0.0, kwargs)
   self.name = process_name(None, kwargs)
   super(Junction, self).__init__(Point(0.0, 0.0), ll = self.label_location, **kwargs)
   self.label_string = self.name
   self.reflect = process_reflect(None, kwargs)
   self.angle = None
Exemplo n.º 4
0
  def draw_label(self, name, **kwargs):
    self.label_angle = process_label_angle(self.label_angle, kwargs)
    self.label_pad = process_label_pad(self.label_pad, kwargs)
    self.font_size = process_font_size(self.font_size, kwargs)
    self.label_location = process_label_location(self.label_location, kwargs)

    self._get_label_locations()
    if self.draw_label_bool:
      self.label_string = name
      super(Node, self).draw_label()
      return self.label
    else:
      return None
Exemplo n.º 5
0
 def __init__(self, junction_edges, **kwargs):
     self.junction_edges = junction_edges
     self.label_edge_number = process_label_edge_number(0, kwargs)
     self.labeled_edge = self.junction_edges[self.label_edge_number]
     self.label_location = process_label_location('top', kwargs)
     self.label_shift = process_label_shift(0.0, kwargs)
     self.name = process_name(None, kwargs)
     super(Junction, self).__init__(Point(0.0, 0.0),
                                    ll=self.label_location,
                                    **kwargs)
     self.label_string = self.name
     self.reflect = process_reflect(None, kwargs)
     self.angle = None
Exemplo n.º 6
0
    def draw_label(self, name, **kwargs):
        self.label_angle = process_label_angle(self.label_angle, kwargs)
        self.label_pad = process_label_pad(self.label_pad, kwargs)
        self.font_size = process_font_size(self.font_size, kwargs)
        self.label_location = process_label_location(self.label_location,
                                                     kwargs)

        self._get_label_locations()
        if self.draw_label_bool:
            self.label_string = name
            super(Node, self).draw_label()
            return self.label
        else:
            return None
Exemplo n.º 7
0
  def draw_label(self, **kwargs):
    self.label_angle = process_label_angle(self.label_angle, kwargs)
    self.label_pad = process_label_pad(self.label_pad, kwargs)
    self.font_size = process_font_size(self.font_size, kwargs)
    self.label_location = process_label_location(self.label_location, kwargs)

    if self.label_string is not None:
      self._guess_label_coordinates()
      self.label = plt.text(self._label_coordinates.x,
                            self._label_coordinates.y, self.label_string,
                            ha="center", va="center", size=self.font_size,
                            rotation=0.0
                           )
      return self.label
    else:
      return None
Exemplo n.º 8
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