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
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
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
def draw_label(self, tail_coords, head_coords, **kwargs): self.label_shift = process_label_shift(self.label_shift, kwargs) self.center_of_rotation.x = 0.5 * (tail_coords.x + head_coords.x) self.center_of_rotation.y = 0.5 * (tail_coords.y + head_coords.y) if self.angle == None: self.get_angle(tail_coords, head_coords) length = abs(tail_coords - head_coords) self.center_of_rotation.x += self.label_shift * 0.5 * length * cos(self._angle_radians) self.center_of_rotation.y += self.label_shift * 0.5 * length * sin(self._angle_radians) super(Junction, self).draw_label() return self.label
def draw_label(self, tail_coords, head_coords, **kwargs): self.label_shift = process_label_shift(self.label_shift, kwargs) self.center_of_rotation.x = 0.5 * (tail_coords.x + head_coords.x) self.center_of_rotation.y = 0.5 * (tail_coords.y + head_coords.y) if self.angle == None: self.get_angle(tail_coords, head_coords) length = abs(tail_coords - head_coords) self.center_of_rotation.x += self.label_shift * 0.5 * length * cos( self._angle_radians) self.center_of_rotation.y += self.label_shift * 0.5 * length * sin( self._angle_radians) super(Junction, self).draw_label() return self.label
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