def Draw(self, dc):
Graphic_Element.Draw(self, dc)
dc.SetPen(MiterPen(wx.BLACK))
dc.SetBrush(wx.WHITE_BRUSH)
if getattr(dc, "printing", False):
name_size = dc.GetTextExtent(self.Name)
executionorder_size = dc.GetTextExtent(str(self.ExecutionOrder))
else:
name_size = self.NameSize
executionorder_size = self.ExecutionOrderSize
text_pos = (self.Pos.x + (self.Size[0] - name_size[0]) / 2,
self.Pos.y + (self.Size[1] - name_size[1]) / 2)
# Draw a rectangle with the variable size
dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Draw variable name
dc.DrawText(self.Name, text_pos[0], text_pos[1])
# Draw connectors
if self.Input:
self.Input.Draw(dc)
if self.Output:
self.Output.Draw(dc)
if self.ExecutionOrder != 0:
# Draw variable execution order
dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0],
self.Pos.y + self.Size[1] + 2)
if not getattr(dc, "printing", False):
DrawHighlightedText(dc, self.Name, self.Highlights, text_pos[0], text_pos[1])
# -------------------------------------------------------------------------------
# Function Block Diagram Connector
# -------------------------------------------------------------------------------
评论列表
文章目录