Next / Previous / Contents / Shipman's homepage

58. Slot.genCoords(): Generate all cell coordinates of a slot

kkck
# - - -   S l o t . g e n C o o r d s

    def genCoords ( self ):
        '''Generate the coordinates in self.
        '''

There are two cases, depending on whether this is a horizontal or vertical slot.

kkck
        #-- 1 --
        if self.isV:    # Vertical case, step through rows
            for rowx in range(self.origin[0],
                              self.origin[0]+self.length):
                yield Coord(rowx, self.origin[1])
        else:           # Horizontal case, step through columns
            for colx in range(self.origin[1],
                              self.origin[1]+self.length):
                yield Coord(self.origin[0], colx)