コード例 #1
0
 def draw(self, gc):
     gc.SetPen(wx.Pen('black', 0))
     if self.color == 0:
         change_b_color(gc, 'orange')
     elif self.color == 1:
         change_b_color(gc, 'red')
     elif self.color == 2:
         change_b_color(gc, 'green')
     elif self.color == 3:
         change_b_color(gc, 'blue')
     elif self.color == 4:
         change_b_color(gc, 'd_orange')
     else:
         assert False, ''
     gc.DrawRectangle(-self.hs / 2, -self.vs / 2, self.hs, self.vs)
コード例 #2
0
 def draw(self, gc, id_show):
     gc.SetPen(wx.Pen('purple', 0))
     change_b_color(gc, 'purple')
     gc.DrawRectangle(-container_vs * 1.1 - YC.sy / 2, -container_hs * 1.1 / 2, container_vs * 1.1, container_hs * 1.1)
     gc.DrawRectangle(-container_vs * 1.1 - YC.sy / 2 + YC.sy + container_vs * 1.1, -container_hs * 1.1 / 2, container_vs * 1.1, container_hs * 1.1)
     gc.DrawRectangle(-YC.sy / 2, -6, YC.sy, 3)
     gc.DrawRectangle(-YC.sy / 2, 3, YC.sy, 3)
     old_tr = gc.GetTransform()
     gc.Translate(self.trolly.px, self.trolly.py)
     self.trolly.draw(gc, self.holding_containers)
     gc.SetTransform(old_tr)
     
     if id_show:
         gc.SetFont(wx.Font(5, wx.SWISS, wx.NORMAL, wx.NORMAL))
         gc.DrawText(str(self.name + '-' + str(self.veh_id)), -container_hs, -container_hs)    
コード例 #3
0
    def draw(self, gc, id_show):
        #draw vessel surface
        if self.isVisible:
            gc.SetPen(wx.Pen(wx.BLACK, 1))
            gc.SetBrush(wx.Brush(wx.Colour(125, 160, 255)))       
            path = gc.CreatePath()
            for i, pos in enumerate(self.v_d_p):
                px, py = pos
                if i == 4:
                    cpx1, cpy1 = Vessel.LOA * 0.96, Vessel.Beam * 0.1
                    cpx2, cpy2 = Vessel.LOA * 0.99, Vessel.Beam * 0.3    
                    path.AddCurveToPoint(cpx1, cpy1, cpx2, cpy2, px, py)                
                elif i == 5:
                    cpx1, cpy1 = Vessel.LOA * 0.99, Vessel.Beam * 0.7
                    cpx2, cpy2 = Vessel.LOA * 0.96, Vessel.Beam * 0.9 
                    path.AddCurveToPoint(cpx1, cpy1, cpx2, cpy2, px, py)
#                if i == 4:
#                    cpx1, cpy1 = Vessel.LOA * 0.95, Vessel.Beam * 0.4
#                    cpx2, cpy2 = Vessel.LOA * 0.95, Vessel.Beam * 0.6
#                    path.AddCurveToPoint(cpx1, cpy1, cpx2, cpy2, px, py)
                else:
                    path.AddLineToPoint(px, py)
            gc.DrawPath(path)
            gc.SetPen(wx.Pen(wx.Colour(210, 209, 208), 0))
            gc.SetBrush(wx.Brush(wx.Colour(210, 209, 208)))
            gc.DrawLines(self.hatch)
            for x, px in enumerate(self.drawing_bays_px):
                gc.SetPen(wx.Pen(wx.Colour(100, 100, 100), 0.5))
                if x != 4:
                    gc.DrawLines([(px - container_hs / 2, self.margin_py), (px - container_hs / 2, self.margin_py + container_vs * Vessel.num_of_stack)])
                    gc.DrawLines([(px + container_hs / 2, self.margin_py), (px + container_hs / 2, self.margin_py + container_vs * Vessel.num_of_stack)])
                    for s in xrange(Vessel.num_of_stack + 1):
                        gc.DrawLines([(px - container_hs / 2, self.margin_py + s * container_vs), (px + container_hs / 2, self.margin_py + s * container_vs)])
                else:
                    change_b_color(gc, 'white')
                    gc.SetPen(wx.Pen(wx.Colour(200, 200, 200), 1))
                    gc.DrawRectangle(px - container_hs / 2, self.margin_py - container_vs * 1, container_hs, container_vs * Vessel.num_of_stack + container_vs * 2)
                    gc.DrawRectangle(px - container_hs / 2 + container_vs / 2, self.margin_py + container_vs * Vessel.num_of_stack / 4, container_hs / 2, container_vs * Vessel.num_of_stack / 2)
            for c in self.holding_containers.values():
                old_tr = gc.GetTransform()
                gc.Translate(c.px, c.py)
                c.draw(gc)
                gc.SetTransform(old_tr)
        if id_show:
            gc.SetFont(wx.Font(5, wx.SWISS, wx.NORMAL, wx.NORMAL))
            gc.DrawText(self.name + '/' + str(self.voyage), -container_hs, 0)