Add additional curvepolygon with compound curve to reference geometry tests

This commit is contained in:
Nyall Dawson 2017-02-04 12:16:15 +10:00
parent ab03453136
commit 11150dde3e
2 changed files with 8 additions and 7 deletions

View File

@ -202,31 +202,31 @@ class TestQgsGeometry(unittest.TestCase):
bbox = geom.geometry().boundingBox()
exp = float(row['x_min'])
result = bbox.xMinimum()
assert doubleNear(result, exp), "Min X {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
self.assertAlmostEqual(result, exp, 5, "Min X {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result))
exp = float(row['y_min'])
result = bbox.yMinimum()
assert doubleNear(result, exp), "Min Y {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
self.assertAlmostEqual(result, exp, 5, "Min Y {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result))
exp = float(row['x_max'])
result = bbox.xMaximum()
assert doubleNear(result, exp), "Max X {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
self.assertAlmostEqual(result, exp, 5, "Max X {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result))
exp = float(row['y_max'])
result = bbox.yMaximum()
assert doubleNear(result, exp), "Max Y {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
self.assertAlmostEqual(result, exp, 5, "Max Y {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result))
# test area calculation
exp = float(row['area'])
result = geom.geometry().area()
assert doubleNear(result, exp), "Area {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
self.assertAlmostEqual(result, exp, 5, "Area {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result))
# test length calculation
exp = float(row['length'])
result = geom.geometry().length()
assert doubleNear(result, exp, 0.00001), "Length {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
self.assertAlmostEqual(result, exp, 5, "Length {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result))
# test perimeter calculation
exp = float(row['perimeter'])
result = geom.geometry().perimeter()
assert doubleNear(result, exp, 0.00001), "Perimeter {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
self.assertAlmostEqual(result, exp, 5, "Perimeter {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result))
def testIntersection(self):
myLine = QgsGeometry.fromPolyline([

View File

@ -120,3 +120,4 @@ Polygon,,,,,,,,,,,,,,Malformed WKT
"PolygonM ((0 0 1, 10 0 1, 10 10 1, 0 10 1, 0 0 1),(5 5 1, 7 5 1, 7 7 1, 5 7 1, 5 5 1),(1 1 1,2 1 1, 2 2 1, 1 2 1, 1 1 1))","POLYGON M ((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))",15,0,95,52,1,2,0,POINT(4.99473684210526 4.99473684210526),0,0,10,10,
"PolygonZ ((0 0 1 , 10 0 1, 10 10 1, 0 10 1, 0 0 1))","POLYGON Z ((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1))",5,0,100,40,1,0,0,POINT(5 5),0,0,10,10,
"PolygonZ ((0 0 1, 10 0 1, 10 10 1, 0 10 1, 0 0 1),(5 5 1, 7 5 1, 7 7 1 , 5 7 1, 5 5 1))","POLYGON Z ((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1))",10,0,96,48,1,1,0,POINT(4.95833333333333 4.95833333333333),0,0,10,10,
"CurvePolygon (CompoundCurve ((2678124.57778842002153397 1225804.43286111624911427, 2678251.0684670670889318 1225964.66278979112394154, 2678201.75901959836483002 1226077.95337014575488865, 2678199.27904875669628382 1226083.94340024818666279, 2678198.13904719380661845 1226083.5034040967002511, 2678188.08903313148766756 1226079.56343783461488783, 2678164.688993189483881 1226068.85351158352568746, 2678152.65896565327420831 1226061.85354482522234321, 2678133.63892276119440794 1226050.92359781125560403),CircularString (2678133.63892276119440794 1226050.92359781125560403, 2678124.47892813989892602 1226045.71365369856357574, 2678115.92887723352760077 1226039.55364341707900167, 2678110.39902341179549694 1226025.70413719792850316, 2678113.52874504774808884 1226011.12356549175456166, 2678117.04747172351926565 1226004.70550769660621881, 2678121.17868330329656601 1225998.66349145700223744, 2678122.91810466628521681 1225991.71089569479227066, 2678120.73861891590058804 1225984.88345037144608796, 2678109.63862727722153068 1225981.37343537760898471, 2678097.99861149024218321 1225981.17354299034923315, 2678087.07146158767864108 1225984.57272616261616349, 2678076.13865283969789743 1225987.95366438734345138, 2678068.26173875294625759 1225987.17441278789192438, 2678060.82864314317703247 1225984.45372360944747925, 2678052.37183309439569712 1225977.24715672573074698, 2678045.5285750487819314 1225968.49374381266534328, 2678039.90821403311565518 1225957.94303491595201194, 2678035.46847799280658364 1225946.84372220188379288, 2678033.64745173417031765 1225940.12937669246457517, 2678032.40841578459367156 1225933.28369381325319409, 2678033.68931351415812969 1225925.84029478346928954, 2678036.55834634136408567 1225918.85362965753301978, 2678039.0693440935574472 1225913.78109931806102395, 2678040.70829536207020283 1225908.363577825948596),(2678040.70829536207020283 1225908.363577825948596, 2678124.57778842002153397 1225804.43286111624911427)))","CurvePolygon (CompoundCurve ((2678124.57778842002153397 1225804.43286111624911427, 2678251.0684670670889318 1225964.66278979112394154, 2678201.75901959836483002 1226077.95337014575488865, 2678199.27904875669628382 1226083.94340024818666279, 2678198.13904719380661845 1226083.5034040967002511, 2678188.08903313148766756 1226079.56343783461488783, 2678164.688993189483881 1226068.85351158352568746, 2678152.65896565327420831 1226061.85354482522234321, 2678133.63892276119440794 1226050.92359781125560403),CircularString (2678133.63892276119440794 1226050.92359781125560403, 2678124.47892813989892602 1226045.71365369856357574, 2678115.92887723352760077 1226039.55364341707900167, 2678110.39902341179549694 1226025.70413719792850316, 2678113.52874504774808884 1226011.12356549175456166, 2678117.04747172351926565 1226004.70550769660621881, 2678121.17868330329656601 1225998.66349145700223744, 2678122.91810466628521681 1225991.71089569479227066, 2678120.73861891590058804 1225984.88345037144608796, 2678109.63862727722153068 1225981.37343537760898471, 2678097.99861149024218321 1225981.17354299034923315, 2678087.07146158767864108 1225984.57272616261616349, 2678076.13865283969789743 1225987.95366438734345138, 2678068.26173875294625759 1225987.17441278789192438, 2678060.82864314317703247 1225984.45372360944747925, 2678052.37183309439569712 1225977.24715672573074698, 2678045.5285750487819314 1225968.49374381266534328, 2678039.90821403311565518 1225957.94303491595201194, 2678035.46847799280658364 1225946.84372220188379288, 2678033.64745173417031765 1225940.12937669246457517, 2678032.40841578459367156 1225933.28369381325319409, 2678033.68931351415812969 1225925.84029478346928954, 2678036.55834634136408567 1225918.85362965753301978, 2678039.0693440935574472 1225913.78109931806102395, 2678040.70829536207020283 1225908.363577825948596),(2678040.70829536207020283 1225908.363577825948596, 2678124.57778842002153397 1225804.43286111624911427)))",34,0,32087.8047511,770.542777805,1,1,0,Point (2678143.67776390677317977 1225948.36456208629533648),2678032.40842,1225804.43286112,2678251.06846707,1226083.94340025,

1 wkt valid_wkt num_points length area perimeter num_geometries num_rings is_closed centroid x_min y_min x_max y_max notes
120 PolygonM ((0 0 1, 10 0 1, 10 10 1, 0 10 1, 0 0 1),(5 5 1, 7 5 1, 7 7 1, 5 7 1, 5 5 1),(1 1 1,2 1 1, 2 2 1, 1 2 1, 1 1 1)) POLYGON M ((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1)) 15 0 95 52 1 2 0 POINT(4.99473684210526 4.99473684210526) 0 0 10 10
121 PolygonZ ((0 0 1 , 10 0 1, 10 10 1, 0 10 1, 0 0 1)) POLYGON Z ((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1)) 5 0 100 40 1 0 0 POINT(5 5) 0 0 10 10
122 PolygonZ ((0 0 1, 10 0 1, 10 10 1, 0 10 1, 0 0 1),(5 5 1, 7 5 1, 7 7 1 , 5 7 1, 5 5 1)) POLYGON Z ((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1)) 10 0 96 48 1 1 0 POINT(4.95833333333333 4.95833333333333) 0 0 10 10
123 CurvePolygon (CompoundCurve ((2678124.57778842002153397 1225804.43286111624911427, 2678251.0684670670889318 1225964.66278979112394154, 2678201.75901959836483002 1226077.95337014575488865, 2678199.27904875669628382 1226083.94340024818666279, 2678198.13904719380661845 1226083.5034040967002511, 2678188.08903313148766756 1226079.56343783461488783, 2678164.688993189483881 1226068.85351158352568746, 2678152.65896565327420831 1226061.85354482522234321, 2678133.63892276119440794 1226050.92359781125560403),CircularString (2678133.63892276119440794 1226050.92359781125560403, 2678124.47892813989892602 1226045.71365369856357574, 2678115.92887723352760077 1226039.55364341707900167, 2678110.39902341179549694 1226025.70413719792850316, 2678113.52874504774808884 1226011.12356549175456166, 2678117.04747172351926565 1226004.70550769660621881, 2678121.17868330329656601 1225998.66349145700223744, 2678122.91810466628521681 1225991.71089569479227066, 2678120.73861891590058804 1225984.88345037144608796, 2678109.63862727722153068 1225981.37343537760898471, 2678097.99861149024218321 1225981.17354299034923315, 2678087.07146158767864108 1225984.57272616261616349, 2678076.13865283969789743 1225987.95366438734345138, 2678068.26173875294625759 1225987.17441278789192438, 2678060.82864314317703247 1225984.45372360944747925, 2678052.37183309439569712 1225977.24715672573074698, 2678045.5285750487819314 1225968.49374381266534328, 2678039.90821403311565518 1225957.94303491595201194, 2678035.46847799280658364 1225946.84372220188379288, 2678033.64745173417031765 1225940.12937669246457517, 2678032.40841578459367156 1225933.28369381325319409, 2678033.68931351415812969 1225925.84029478346928954, 2678036.55834634136408567 1225918.85362965753301978, 2678039.0693440935574472 1225913.78109931806102395, 2678040.70829536207020283 1225908.363577825948596),(2678040.70829536207020283 1225908.363577825948596, 2678124.57778842002153397 1225804.43286111624911427))) CurvePolygon (CompoundCurve ((2678124.57778842002153397 1225804.43286111624911427, 2678251.0684670670889318 1225964.66278979112394154, 2678201.75901959836483002 1226077.95337014575488865, 2678199.27904875669628382 1226083.94340024818666279, 2678198.13904719380661845 1226083.5034040967002511, 2678188.08903313148766756 1226079.56343783461488783, 2678164.688993189483881 1226068.85351158352568746, 2678152.65896565327420831 1226061.85354482522234321, 2678133.63892276119440794 1226050.92359781125560403),CircularString (2678133.63892276119440794 1226050.92359781125560403, 2678124.47892813989892602 1226045.71365369856357574, 2678115.92887723352760077 1226039.55364341707900167, 2678110.39902341179549694 1226025.70413719792850316, 2678113.52874504774808884 1226011.12356549175456166, 2678117.04747172351926565 1226004.70550769660621881, 2678121.17868330329656601 1225998.66349145700223744, 2678122.91810466628521681 1225991.71089569479227066, 2678120.73861891590058804 1225984.88345037144608796, 2678109.63862727722153068 1225981.37343537760898471, 2678097.99861149024218321 1225981.17354299034923315, 2678087.07146158767864108 1225984.57272616261616349, 2678076.13865283969789743 1225987.95366438734345138, 2678068.26173875294625759 1225987.17441278789192438, 2678060.82864314317703247 1225984.45372360944747925, 2678052.37183309439569712 1225977.24715672573074698, 2678045.5285750487819314 1225968.49374381266534328, 2678039.90821403311565518 1225957.94303491595201194, 2678035.46847799280658364 1225946.84372220188379288, 2678033.64745173417031765 1225940.12937669246457517, 2678032.40841578459367156 1225933.28369381325319409, 2678033.68931351415812969 1225925.84029478346928954, 2678036.55834634136408567 1225918.85362965753301978, 2678039.0693440935574472 1225913.78109931806102395, 2678040.70829536207020283 1225908.363577825948596),(2678040.70829536207020283 1225908.363577825948596, 2678124.57778842002153397 1225804.43286111624911427))) 34 0 32087.8047511 770.542777805 1 1 0 Point (2678143.67776390677317977 1225948.36456208629533648) 2678032.40842 1225804.43286112 2678251.06846707 1226083.94340025