def _getAllPossibleMatches(self): letters = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', \ 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'ww', 'xx', 'yy'] index = 0 matches = [] for x in range(1,6): for y in range(1,6): p = Point(x,y) p.Value = letters[index] index += 1 matches.append(p) return matches
def SetPoints(self): if self.OnlyTwoPointsInLine(): self.__points.append(self.Begin) self.__points.append(self.End) return endRange = self.EndRange() slopeX = 0 slopeY = 0 if self.IsNorth(): self.__direction = "North" for x in range(0, endRange): p = Point(self.Begin.X, self.Begin.Y + x) p.Value = CardinalDirection.North self.__points.append(p) elif self.IsSouth(): self.__direction = "South" for x in range(0, endRange): p = Point(self.Begin.X, self.Begin.Y - x) p.Value = CardinalDirection.South self.__points.append(p) elif self.IsEast(): self.__direction = "East" for x in range(0, endRange): p = Point(self.Begin.X + x, self.Begin.Y) p.Value = CardinalDirection.East self.__points.append(p) elif self.IsWest(): self.__direction = "West" for x in range(0, endRange): p = Point(self.Begin.X - x, self.Begin.Y) p.Value = CardinalDirection.West self.__points.append(p) elif self.IsNorthEast(): self.__direction = "Northeast" for x in range(0, endRange): slope = self.GetSlopesAsPoint(x) p = Point(self.Begin.X + slope.X, self.Begin.Y + slope.Y) p.Value = CardinalDirection.Northeast self.__points.append(p) elif self.IsNorthWest(): self.__direction = "Northwest" for x in range(0, endRange): slope = self.GetSlopesAsPoint(x) p = Point(self.Begin.X - slope.X, self.Begin.Y + slope.Y) p.Value = CardinalDirection.Northwest self.__points.append(p) elif self.IsSouthEast(): self.__direction = "Southeast" for x in range(0, endRange): slope = self.GetSlopesAsPoint(x) p = Point(self.Begin.X + slope.X, self.Begin.Y - slope.Y) p.Value = CardinalDirection.Southeast self.__points.append(p) elif self.IsSouthWest(): self.__direction = "Southwest" for x in range(0, endRange): slope = self.GetSlopesAsPoint(x) p = Point(self.Begin.X - slope.X, self.Begin.Y - slope.Y) p.Value = CardinalDirection.Southwest self.__points.append(p)
sys.path.append('..\..\LexLib') from page import Page from shapemaker import ShapeMaker from line import Line,CardinalDirection from point import Point from iofactory import ConsoleIO cio = ConsoleIO() g = Page(50) #g.Draw() m = ShapeMaker(g, cio) # NORTH beg = Point(25,25) end = Point(25,49) end.Value = '0' n = Line(beg, end) # NORTHEAST beg = Point(25,25) end = Point(49,49) end.Value = '1' ne = Line(beg, end) # EAST beg = Point(25,25) end = Point(49, 25) end.Value = '2' e = Line(beg, end) # SOUTHEAST