示例#1
0
 def move_corner(self, corner, xinc, yinc):
     """ Move selected corner, adjusting connected edges
     :corner: selected corner
     :xinc: x destination increment
     :yinc: y destination increment
     """
     delta_x = xinc
     delta_y = yinc
     print("move_edge: %s  by delta_x=%d,delta_y=%d" %
           (corner, delta_x, delta_y))
     mover = SelectMover(self, delta_x=delta_x, delta_y=delta_y)
     mover.add_moves(parts=corner)
     ###mover.add_moves(parts=edge.connecteds)
     ###mover.add_adjusts(edge.connecteds)      # Adjust those connected to corners and so on
     mover.move_list(delta_x, delta_y)
示例#2
0
 def move_edge(self, edge, xinc,  yinc, adjusts=None):
     
     
     """ Move selected edge, adjusting connected parts
     Direction of movement is constrained to perpendicular to edge
     Connected parts are:
         the corners at each edge end
         the end-points of the edges, not including this edge,
             connected to the end-corners
     :edge:  selected edge
     :xinc:  x destination delta
     :yinc:  y destination delta
     :adjusts: adjusted connections
                 Default: all connections
     :highlight: True - highlight after move
     """
     self.display_clear(edge)      # Clear display before moveing
     delta_x = xinc
     delta_y = yinc
     edge_dx, edge_dy = edge.edge_dxy()
     if edge_dx == 0:
         delta_y = 0     # No movement parallel to edge
     if edge_dy == 0:
         delta_x = 0     # No movement parallel to edge
     coord = edge.loc.coord
     p1, p2 = coord[0], coord[1]
     SlTrace.lg("move_edge: %s by delta_x=%d,delta_y=%d"
            % (edge, delta_x, delta_y), "move_part")
     """ Collect moves group:
         Collect all parts which need to be moved in whole or part.
         Each part is present once.  If an edge end is moved only the other edge's
         ends need to be adjusted
              
     """
     mover = SelectMover(self, delta_x=delta_x, delta_y=delta_y)
     mover.add_moves(parts=edge)
     ###mover.add_moves(parts=edge.connecteds)
     ###mover.add_adjusts(edge.connecteds)      # Adjust those connected to corners and so on
     mover.move_list(delta_x, delta_y)
示例#3
0
 def move_corner(self, corner, xinc, yinc):
     """ Move selected corner, adjusting connected edges
     :corner: selected corner
     :xinc: x destination increment
     :yinc: y destination increment
     """
     delta_x = xinc
     delta_y = yinc
     SlTrace.lg(
         "move: %s  by delta_x=%d,delta_y=%d" % (corner, delta_x, delta_y),
         "move_part")
     """ Split movements in to two directions to restrict propagation
     of affected parts
     """
     if delta_x != 0:
         mover = SelectMover(self, delta_x=delta_x)
         mover.add_moves(parts=corner)
         ###mover.add_moves(parts=edge.connecteds)
         ###mover.add_adjusts(edge.connecteds)      # Adjust those connected to corners and so on
         mover.move_list(delta_x, 0)
     if delta_y != 0:
         mover = SelectMover(self, delta_y=delta_y)
         mover.add_moves(parts=corner)
         ###mover.add_moves(parts=edge.connecteds)
         ###mover.add_adjusts(edge.connecteds)      # Adjust those connected to corners and so on
         mover.move_list(0, delta_y)