예제 #1
0
 def testPushLine(self):
     npt, wpt, wpi = poialign.getPoiAndEntranceLocations(
         Pt(0, 1), osmcmd.Chain([Pt(-10, 0), Pt(10, 0)]), 2)
     self.assertAlmostEqual(npt.x, 0)
     self.assertAlmostEqual(npt.y, 2)
     self.assertAlmostEqual(wpt.x, 0)
     self.assertAlmostEqual(wpt.y, 0)
     self.assertEqual(wpi, (0, 1))
예제 #2
0
 def testPullInsideAngle(self):
     npt, wpt, wpi = poialign.getPoiAndEntranceLocations(
         Pt(4, 3), osmcmd.Chain([Pt(0, 10), Pt(0, 0),
                                 Pt(10, 0)]), 2)
     self.assertAlmostEqual(npt.x, 4)
     self.assertAlmostEqual(npt.y, 2)
     self.assertAlmostEqual(wpt.x, 4)
     self.assertAlmostEqual(wpt.y, 0)
     self.assertEqual(wpi, (1, 2))
예제 #3
0
 def testPushInsideAcuteAngle2(self):
     npt, wpt, wpi = poialign.getPoiAndEntranceLocations(
         Pt(2, 0), osmcmd.Chain([Pt(10, 5), Pt(0, 0),
                                 Pt(10, -5)]), math.sqrt(5))
     self.assertAlmostEqual(npt.x, 5, places=3)
     self.assertAlmostEqual(npt.y, 0, places=3)
     self.assertAlmostEqual(wpt.x, 0, places=3)
     self.assertAlmostEqual(wpt.y, 0, places=3)
     self.assertEqual(wpi, (1, ))
예제 #4
0
 def testPushInsideAngleSide(self):
     npt, wpt, wpi = poialign.getPoiAndEntranceLocations(
         Pt(1, 5), osmcmd.Chain([Pt(0, 10), Pt(0, 0),
                                 Pt(10, 0)]), 2)
     self.assertAlmostEqual(npt.x, 2)
     self.assertAlmostEqual(npt.y, 5)
     self.assertAlmostEqual(wpt.x, 0)
     self.assertAlmostEqual(wpt.y, 5)
     self.assertEqual(wpi, (0, 1))
예제 #5
0
 def testPushInsideBluntAngle(self):
     npt, wpt, wpi = poialign.getPoiAndEntranceLocations(
         Pt(1, 0), osmcmd.Chain([Pt(10, 50),
                                 Pt(0, 0),
                                 Pt(10, -50)]), 10)
     self.assertGreater(npt.x, 10)
     self.assertAlmostEqual(npt.y, 0, places=3)
     self.assertAlmostEqual(wpt.x, 0, places=3)
     self.assertAlmostEqual(wpt.y, 0, places=3)
     self.assertEqual(wpi, (1, ))
예제 #6
0
 def testPushOutsideAngle(self):
     npt, wpt, wpi = poialign.getPoiAndEntranceLocations(
         Pt(0, 21), osmcmd.Chain([Pt(-10, 0),
                                  Pt(0, 20),
                                  Pt(20, 0)]), 2)
     self.assertAlmostEqual(npt.x, 0)
     self.assertAlmostEqual(npt.y, 22)
     self.assertAlmostEqual(wpt.x, 0)
     self.assertAlmostEqual(wpt.y, 20)
     self.assertEqual(wpi, (1, ))
예제 #7
0
 def testPushBeak(self):
     npt, wpt, wpi = poialign.getPoiAndEntranceLocations(
         Pt(1, 1),
         osmcmd.Chain(
             [Pt(0, 10),
              Pt(0, 1),
              Pt(-100, -100),
              Pt(1, 0),
              Pt(10, 0)]), 2)
     self.assertAlmostEqual(npt.x, 2)
     self.assertAlmostEqual(npt.y, 2)