2020-04-05 22:34:11 +08:00
|
|
|
FONT_SIZE = 12
|
|
|
|
|
|
|
|
GRAPH_POFFSET = 40
|
|
|
|
GRAPH_BOFFSET = 40
|
|
|
|
GRAPH_PSPAN = 20
|
|
|
|
GRAPH_BSPAN = 20
|
2020-04-09 11:21:52 +08:00
|
|
|
GRAPH_LAYER_SPAN = 50
|
|
|
|
GRAPH_BB_SPAN = 25
|
2020-04-05 22:34:11 +08:00
|
|
|
|
|
|
|
BB_POFFSET = 20
|
|
|
|
BB_BOFFSET = 10
|
2020-04-09 22:41:41 +08:00
|
|
|
BB_PSPAN = 20
|
|
|
|
BB_BSPAN = 20
|
2020-04-05 22:34:11 +08:00
|
|
|
BB_PBSIZE = 6
|
|
|
|
|
|
|
|
CELL_WIDTH = 15
|
|
|
|
CELL_HEIGHT = 5
|
|
|
|
|
2020-04-09 11:21:52 +08:00
|
|
|
GRAPH_CONTENTOFFSET_X = 40
|
|
|
|
GRAPH_CONTENTOFFSET_Y = 40
|
|
|
|
|
2020-04-05 22:34:11 +08:00
|
|
|
|
|
|
|
class LinkType(object):
|
|
|
|
PLOCAL = 0
|
|
|
|
SHORTCUR = 1
|
|
|
|
PIO = 2
|
|
|
|
BIO = 3
|
|
|
|
|
|
|
|
class BBTreeNode(object):
|
|
|
|
def __init__(self, ckid, layer):
|
|
|
|
self.bb = ckid
|
|
|
|
self.layer = layer
|
|
|
|
self.nodes = []
|
|
|
|
|
|
|
|
class BBResult(object):
|
|
|
|
def __init__(self, name, assistName, pin, pout, bin, bout, expandable):
|
|
|
|
self.name = name
|
|
|
|
self.assistName = assistName
|
|
|
|
self.pin = int(pin)
|
|
|
|
self.pout = int(pout)
|
|
|
|
self.bin = int(bin)
|
|
|
|
self.bout = int(bout)
|
|
|
|
self.x = 0.0
|
|
|
|
self.y = 0.0
|
|
|
|
self.width = 0.0
|
|
|
|
self.height = 0.0
|
|
|
|
self.expandable = expandable
|
|
|
|
|
|
|
|
def computSize(self):
|
|
|
|
wText = max(len(self.name), len(self.assistName)) * FONT_SIZE
|
|
|
|
hText = FONT_SIZE * 4
|
|
|
|
|
|
|
|
wp = 2 * BB_POFFSET + max(self.pin, self.pout) * (BB_PBSIZE + BB_PSPAN)
|
|
|
|
hb = 2 * BB_BOFFSET + max(self.bin, self.bout) * (BB_PBSIZE + BB_BSPAN)
|
|
|
|
|
|
|
|
self.width = max(wp, wText)
|
|
|
|
self.height = max(hb, hText)
|
2020-04-09 11:21:52 +08:00
|
|
|
|
|
|
|
class pOperArrangement(object):
|
|
|
|
def __init__(self, attachedBB, sublayer):
|
|
|
|
self.attachedBB = attachedBB
|
|
|
|
self.sublayer = sublayer
|
|
|
|
|
|
|
|
class OperResult(object):
|
|
|
|
def __init__(self, name, x):
|
|
|
|
self.name = name
|
|
|
|
self.x = x
|
|
|
|
self.y = 0.0
|
|
|
|
self.height = 0.0
|
|
|
|
self.width = 0.0
|
|
|
|
|
|
|
|
def computSize(self):
|
|
|
|
wText = len(self.name) * FONT_SIZE
|
|
|
|
hText = FONT_SIZE * 4
|
|
|
|
|
|
|
|
wp = 2 * BB_POFFSET + 2 * (BB_PBSIZE + BB_PSPAN)
|
|
|
|
hb = 2 * BB_BOFFSET + 0 * (BB_PBSIZE + BB_BSPAN)
|
|
|
|
|
|
|
|
self.width = max(wp, wText)
|
|
|
|
self.height = max(hb, hText)
|