コード例 #1
0
ファイル: ellipse.py プロジェクト: aaronmorgenegg/cs5700
 def __getMirrorFocus(self, center, focus):
     Validator.validatePoint(center, "Center point invalid")
     Validator.validatePoint(focus, "Focus point invalid")
     dx = focus.x - center.x
     dy = focus.y - center.y
     x = focus.x - dx * 2
     y = focus.y - dy * 2
     return Point(x, y)
コード例 #2
0
ファイル: line.py プロジェクト: aaronmorgenegg/cs5700
 def __constructWithPoints(self, point1, point2):
     try:
         Validator.validatePoint(point1, "Invalid point1")
         Validator.validatePoint(point2, "Invalid point2")
         self.__point1 = point1
         self.__point2 = point2
         Validator.validateLine(value=self, errorMessage="Line invalid")
         return True
     except ShapeException:
         return False
コード例 #3
0
    def testValidatePoint(self):
        p1 = Point(1, 1)
        Validator.validatePoint(p1, "Point unexpectedly invalid")

        self.assertRaises(ShapeException, Validator.validatePoint, "(1, 1)",
                          "String \'(1, 1)\' is not a valid point")
コード例 #4
0
    def __constructWithCoords(self, x1, y1):
        self.__x = x1
        self.__y = y1

        Validator.validatePoint(value=self,
                                errorMessage="Point construction failed")