def testDescribePathForTextClockwise(self):
        expectedPath = "M 3995.88860426 4842.99213127 A 3000 3000 0 0 0 1776.45713531 2102.22252113"
        self.assertEqual(
            ArcDrawingTools.describeArcClockwise(1000, 5000, 3000, 15, 87),
            expectedPath)

        expectedPath = "M 450.0 200.0 A 150 150 0 0 0 193.933982822 93.933982822"
        self.assertEqual(
            ArcDrawingTools.describeArcClockwise(300, 200, 150, -45, 90),
            expectedPath)
Пример #2
0
 def processRingSection(self, sectionOrderWidget, number):
     sortedDevices = sectionOrderWidget.getSortedDevices()
     deviceNumber = 0
     baseAngle = (360.0 / len(self.deviceOrderWidgets)) * number
     for device in sortedDevices:
         angle = baseAngle + deviceNumber
         [xCoord, yCoord] = ArcDrawingTools.polarToCartesian(0, 0, 1, angle)
         device.realCoordinates = [float(xCoord), float(yCoord)]
         self.tDeviceManager.putDeviceParametersIntoDb(device)
         deviceNumber -= 1
 def testPolarToCartesian(self):
     self.assertEqual(ArcDrawingTools.polarToCartesian(2005, 1500, 600, 95),
                      [2602.716818855047, 1552.2934456485948])
     self.assertEqual(ArcDrawingTools.polarToCartesian(20, 30, 10, 180),
                      [20.0, 40.0])
    def testDescribePathForTextAntiClockwise(self):
        expectedPath = "M 1776.45713531 2102.22252113 A 3000 3000 0 0 1 3995.88860426 4842.99213127"
        self.assertEqual(ArcDrawingTools.describeArcAnticlockwise(1000, 5000, 3000, 15, 87), expectedPath)

        expectedPath = "M 193.933982822 93.933982822 A 150 150 0 0 1 450.0 200.0"
        self.assertEqual(ArcDrawingTools.describeArcAnticlockwise(300, 200, 150, -45, 90), expectedPath)
 def testPolarToCartesian(self):
     self.assertEqual(ArcDrawingTools.polarToCartesian(2005, 1500, 600, 95), [2602.716818855047, 1552.2934456485948])
     self.assertEqual(ArcDrawingTools.polarToCartesian(20, 30, 10, 180), [20.0, 40.0])