示例#1
0
 def get(self, mf, formats):
     gg = self.get_gg(mf)
     if isinstance(formats, str):
         res, = gg_get_formats(gg, (formats,))
     else:
         res = gg_get_formats(gg, formats)
     return res
示例#2
0
文件: formatters.py 项目: rusi/mcdp
    def get(self, mf, formats):
        from mcdp_report.gg_utils import gg_get_formats

        #         with timeit_wall('GGFormatter - get_gg'):
        gg = self.get_gg(mf)

        if isinstance(formats, str):
            res, = gg_get_formats(gg, (formats, ))
        else:
            res = gg_get_formats(gg, formats)
        return res
def get_png_data_poset(library, name, x, data_format):
    if isinstance(x, FinitePoset):
        import mcdp_report.my_gvgen as gvgen
        direction = 'TB'
        assert direction in ['LR', 'TB']
        gg = gvgen.GvGen(options="rankdir=%s" % direction)
        
        e2n = {}
        for e in x.elements:
            n = gg.newItem(e)
            e2n[e] = n
            gg.propertyAppend(n, "shape", "none")
        
        
        for e1, e2 in x.relations:
            # check if e2 is minimal
            all_up = set(_ for _ in x.elements if x.leq(e1, _) and not x.leq(_, e1))
            
            minimals = poset_minima(all_up, x.leq)
            
            if not e2 in minimals:
                continue
            
            low = e2n[e1]
            high = e2n[e2]
            l = gg.newLink(high, low )
            gg.propertyAppend(l, "arrowhead", "none")
            gg.propertyAppend(l, "arrowtail", "none")
            
        data, = gg_get_formats(gg, (data_format,))
        return data
    else:
        s = str(x)
        return create_image_with_string(s, size=(512, 512), color=(128, 128, 128))
示例#4
0
文件: plot.py 项目: AndreaCensi/mcdp
def return_formats2(gg, prefix):
    formats = ['png', 'pdf', 'svg']
    data = gg_get_formats(gg, formats)
    res = [ (data_format, prefix, d)
            for data_format, d in zip(formats, data)]
    return res
示例#5
0
文件: plot.py 项目: kannode/mcdp
def return_formats2(gg, prefix):
    formats = ['png', 'pdf', 'svg']
    data = gg_get_formats(gg, formats)
    res = [(data_format, prefix, d) for data_format, d in zip(formats, data)]
    return res