@@ -4356,6 +4356,35 @@ def testClipped(self):
4356
4356
self .assertTrue (compareWkt (result , exp , 0.00001 ),
4357
4357
"clipped: mismatch Expected:\n {}\n Got:\n {}\n " .format (exp , result ))
4358
4358
4359
+ def testCreateWedgeBuffer (self ):
4360
+ tests = [[QgsPoint (1 , 11 ), 0 , 45 , 2 , 0 , 'CurvePolygon (CompoundCurve (CircularString (0.23463313526982044 12.84775906502257392, 1 13, 1.76536686473017967 12.84775906502257392),(1.76536686473017967 12.84775906502257392, 1 11),(1 11, 0.23463313526982044 12.84775906502257392)))' ],
4361
+ [QgsPoint (1 , 11 ), 90 , 45 , 2 , 0 ,
4362
+ 'CurvePolygon (CompoundCurve (CircularString (2.84775906502257348 11.76536686473017923, 3 11, 2.84775906502257348 10.23463313526982077),(2.84775906502257348 10.23463313526982077, 1 11),(1 11, 2.84775906502257348 11.76536686473017923)))' ],
4363
+ [QgsPoint (1 , 11 ), 180 , 90 , 2 , 0 ,
4364
+ 'CurvePolygon (CompoundCurve (CircularString (2.41421356237309492 9.58578643762690419, 1.00000000000000022 9, -0.41421356237309492 9.58578643762690419),(-0.41421356237309492 9.58578643762690419, 1 11),(1 11, 2.41421356237309492 9.58578643762690419)))' ],
4365
+ [QgsPoint (1 , 11 ), 0 , 200 , 2 , 0 ,
4366
+ 'CurvePolygon (CompoundCurve (CircularString (-0.96961550602441604 10.65270364466613984, 0.99999999999999956 13, 2.96961550602441626 10.65270364466613984),(2.96961550602441626 10.65270364466613984, 1 11),(1 11, -0.96961550602441604 10.65270364466613984)))' ],
4367
+ [QgsPoint (1 , 11 ), 0 , 45 , 2 , 1 ,
4368
+ 'CurvePolygon (CompoundCurve (CircularString (0.23463313526982044 12.84775906502257392, 1 13, 1.76536686473017967 12.84775906502257392),(1.76536686473017967 12.84775906502257392, 1.38268343236508984 11.92387953251128607),CircularString (1.38268343236508984 11.92387953251128607, 0.99999999999999978 12, 0.61731656763491016 11.92387953251128607),(0.61731656763491016 11.92387953251128607, 0.23463313526982044 12.84775906502257392)))' ],
4369
+ [QgsPoint (1 , 11 ), 0 , 200 , 2 , 1 ,
4370
+ 'CurvePolygon (CompoundCurve (CircularString (-0.96961550602441604 10.65270364466613984, 0.99999999999999956 13, 2.96961550602441626 10.65270364466613984),(2.96961550602441626 10.65270364466613984, 1.98480775301220813 10.82635182233306992),CircularString (1.98480775301220813 10.82635182233306992, 0.99999999999999978 12, 0.01519224698779198 10.82635182233306992),(0.01519224698779198 10.82635182233306992, -0.96961550602441604 10.65270364466613984)))' ],
4371
+ [QgsPoint (1 , 11 , 3 ), 0 , 45 , 2 , 0 ,
4372
+ 'CurvePolygonZ (CompoundCurveZ (CircularStringZ (0.23463313526982044 12.84775906502257392 3, 1 13 3, 1.76536686473017967 12.84775906502257392 3),(1.76536686473017967 12.84775906502257392 3, 1 11 3),(1 11 3, 0.23463313526982044 12.84775906502257392 3)))' ],
4373
+ [QgsPoint (1 , 11 , m = 3 ), 0 , 45 , 2 , 0 ,
4374
+ 'CurvePolygonM (CompoundCurveM (CircularStringM (0.23463313526982044 12.84775906502257392 3, 1 13 3, 1.76536686473017967 12.84775906502257392 3),(1.76536686473017967 12.84775906502257392 3, 1 11 3),(1 11 3, 0.23463313526982044 12.84775906502257392 3)))' ]
4375
+ ]
4376
+ for t in tests :
4377
+ input = t [0 ]
4378
+ azimuth = t [1 ]
4379
+ width = t [2 ]
4380
+ outer = t [3 ]
4381
+ inner = t [4 ]
4382
+ o = QgsGeometry .createWedgeBuffer (input , azimuth , width , outer , inner )
4383
+ exp = t [5 ]
4384
+ result = o .asWkt ()
4385
+ self .assertTrue (compareWkt (result , exp , 0.01 ),
4386
+ "wedge buffer: mismatch Expected:\n {}\n Got:\n {}\n " .format (exp , result ))
4387
+
4359
4388
def testHausdorff (self ):
4360
4389
tests = [["POLYGON((0 0, 0 2, 1 2, 2 2, 2 0, 0 0))" , "POLYGON((0.5 0.5, 0.5 2.5, 1.5 2.5, 2.5 2.5, 2.5 0.5, 0.5 0.5))" , 0.707106781186548 ],
4361
4390
["LINESTRING (0 0, 2 1)" , "LINESTRING (0 0, 2 0)" , 1 ],
0 commit comments