Esempio n. 1
0
 def draw_lines(self, lines, layer=None, clear_layer=False, redraw=False):
     # every line must be of the form:
     # - start: XYZ
     # - end: XYZ
     # - or line: start, end
     # - width: float
     # - color: RGB
     # - name: None
     # - label?
     draw_lines(lines, layer=layer)
Esempio n. 2
0
 def draw_edges(self, width=0.05, keys=None, colors=None):
     self.clear_edges()
     self.clear_edgelabels()
     keys = keys or list(self.datastructure.edges())
     lines = [0] * len(keys)
     if colors is None:
         colors = {key: self.defaults['color.line'] for key in keys}
     for index, (u, v) in enumerate(keys):
         lines[index] = {
             'start': self.datastructure.vertex_coordinates(u),
             'end': self.datastructure.vertex_coordinates(v),
             'layer': self.layer,
             'color': colors[(u, v)],
             'width': width,
             'name': '{}.edge.{}-{}'.format(self.datastructure, u, v)
         }
     objects = draw_lines(lines)
     layer_collection = create_collection(self.layer)
     edge_collection_name = "{}.edges".format(self.datastructure.name)
     edge_collection = create_collection(edge_collection_name,
                                         parent=layer_collection)
     for obj in objects:
         for collection in obj.users_collection:
             collection.objects.unlink(obj)
         edge_collection.objects.link(obj)
     self.edge_objects = objects
     self.edge_collection = edge_collection
Esempio n. 3
0
    def draw_edges(self, width=0.05, keys=None, colors=None):
        self.clear_edges()
        self.clear_edgelabels()

        keys = keys or list(self.datastructure.edges())
        lines = [0] * len(keys)

        if colors is None:
            colors = {key: self.defaults['color.line'] for key in keys}

        for c, (u, v) in enumerate(keys):
            lines[c] = {
                'start': self.datastructure.vertex_coordinates(u),
                'end': self.datastructure.vertex_coordinates(v),
                'layer': self.layer,
                'color': colors[(u, v)],
                'width': width,
                'name': 'E{}-{}'.format(u, v),
            }

        self.edge_objects = draw_lines(lines=lines)