@@ -2480,6 +2480,121 @@ def testWkbTypes(self):
2480
2480
assert QgsWKBTypes .addM (QgsWKBTypes .MultiLineString25D ) == QgsWKBTypes .MultiLineString25D
2481
2481
assert QgsWKBTypes .addM (QgsWKBTypes .MultiPolygon25D ) == QgsWKBTypes .MultiPolygon25D
2482
2482
2483
+ # test dropping z dimension from types
2484
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .Unknown ) == QgsWKBTypes .Unknown
2485
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .Point ) == QgsWKBTypes .Point
2486
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .PointZ ) == QgsWKBTypes .Point
2487
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .PointM ) == QgsWKBTypes .PointM
2488
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .PointZM ) == QgsWKBTypes .PointM
2489
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPoint ) == QgsWKBTypes .MultiPoint
2490
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPointZ ) == QgsWKBTypes .MultiPoint
2491
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPointM ) == QgsWKBTypes .MultiPointM
2492
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPointZM ) == QgsWKBTypes .MultiPointM
2493
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .LineString ) == QgsWKBTypes .LineString
2494
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .LineStringZ ) == QgsWKBTypes .LineString
2495
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .LineStringM ) == QgsWKBTypes .LineStringM
2496
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .LineStringZM ) == QgsWKBTypes .LineStringM
2497
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiLineString ) == QgsWKBTypes .MultiLineString
2498
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiLineStringZ ) == QgsWKBTypes .MultiLineString
2499
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiLineStringM ) == QgsWKBTypes .MultiLineStringM
2500
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiLineStringZM ) == QgsWKBTypes .MultiLineStringM
2501
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .Polygon ) == QgsWKBTypes .Polygon
2502
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .PolygonZ ) == QgsWKBTypes .Polygon
2503
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .PolygonM ) == QgsWKBTypes .PolygonM
2504
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .PolygonZM ) == QgsWKBTypes .PolygonM
2505
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPolygon ) == QgsWKBTypes .MultiPolygon
2506
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPolygonZ ) == QgsWKBTypes .MultiPolygon
2507
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPolygonM ) == QgsWKBTypes .MultiPolygonM
2508
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPolygonZM ) == QgsWKBTypes .MultiPolygonM
2509
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .GeometryCollection ) == QgsWKBTypes .GeometryCollection
2510
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .GeometryCollectionZ ) == QgsWKBTypes .GeometryCollection
2511
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .GeometryCollectionM ) == QgsWKBTypes .GeometryCollectionM
2512
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .GeometryCollectionZM ) == QgsWKBTypes .GeometryCollectionM
2513
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CircularString ) == QgsWKBTypes .CircularString
2514
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CircularStringZ ) == QgsWKBTypes .CircularString
2515
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CircularStringM ) == QgsWKBTypes .CircularStringM
2516
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CircularStringZM ) == QgsWKBTypes .CircularStringM
2517
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CompoundCurve ) == QgsWKBTypes .CompoundCurve
2518
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CompoundCurveZ ) == QgsWKBTypes .CompoundCurve
2519
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CompoundCurveM ) == QgsWKBTypes .CompoundCurveM
2520
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CompoundCurveZM ) == QgsWKBTypes .CompoundCurveM
2521
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CurvePolygon ) == QgsWKBTypes .CurvePolygon
2522
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CurvePolygonZ ) == QgsWKBTypes .CurvePolygon
2523
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CurvePolygonM ) == QgsWKBTypes .CurvePolygonM
2524
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .CurvePolygonZM ) == QgsWKBTypes .CurvePolygonM
2525
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiCurve ) == QgsWKBTypes .MultiCurve
2526
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiCurveZ ) == QgsWKBTypes .MultiCurve
2527
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiCurveM ) == QgsWKBTypes .MultiCurveM
2528
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiCurveZM ) == QgsWKBTypes .MultiCurveM
2529
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiSurface ) == QgsWKBTypes .MultiSurface
2530
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiSurfaceZ ) == QgsWKBTypes .MultiSurface
2531
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiSurfaceM ) == QgsWKBTypes .MultiSurfaceM
2532
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiSurfaceZM ) == QgsWKBTypes .MultiSurfaceM
2533
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .NoGeometry ) == QgsWKBTypes .NoGeometry
2534
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .Point25D ) == QgsWKBTypes .Point
2535
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .LineString25D ) == QgsWKBTypes .LineString
2536
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .Polygon25D ) == QgsWKBTypes .Polygon
2537
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPoint25D ) == QgsWKBTypes .MultiPoint
2538
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiLineString25D ) == QgsWKBTypes .MultiLineString
2539
+ assert QgsWKBTypes .dropZ (QgsWKBTypes .MultiPolygon25D ) == QgsWKBTypes .MultiPolygon
2540
+
2541
+ # test dropping m dimension from types
2542
+ assert QgsWKBTypes .dropM (QgsWKBTypes .Unknown ) == QgsWKBTypes .Unknown
2543
+ assert QgsWKBTypes .dropM (QgsWKBTypes .Point ) == QgsWKBTypes .Point
2544
+ assert QgsWKBTypes .dropM (QgsWKBTypes .PointZ ) == QgsWKBTypes .PointZ
2545
+ assert QgsWKBTypes .dropM (QgsWKBTypes .PointM ) == QgsWKBTypes .Point
2546
+ assert QgsWKBTypes .dropM (QgsWKBTypes .PointZM ) == QgsWKBTypes .PointZ
2547
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPoint ) == QgsWKBTypes .MultiPoint
2548
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPointZ ) == QgsWKBTypes .MultiPointZ
2549
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPointM ) == QgsWKBTypes .MultiPoint
2550
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPointZM ) == QgsWKBTypes .MultiPointZ
2551
+ assert QgsWKBTypes .dropM (QgsWKBTypes .LineString ) == QgsWKBTypes .LineString
2552
+ assert QgsWKBTypes .dropM (QgsWKBTypes .LineStringZ ) == QgsWKBTypes .LineStringZ
2553
+ assert QgsWKBTypes .dropM (QgsWKBTypes .LineStringM ) == QgsWKBTypes .LineString
2554
+ assert QgsWKBTypes .dropM (QgsWKBTypes .LineStringZM ) == QgsWKBTypes .LineStringZ
2555
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiLineString ) == QgsWKBTypes .MultiLineString
2556
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiLineStringZ ) == QgsWKBTypes .MultiLineStringZ
2557
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiLineStringM ) == QgsWKBTypes .MultiLineString
2558
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiLineStringZM ) == QgsWKBTypes .MultiLineStringZ
2559
+ assert QgsWKBTypes .dropM (QgsWKBTypes .Polygon ) == QgsWKBTypes .Polygon
2560
+ assert QgsWKBTypes .dropM (QgsWKBTypes .PolygonZ ) == QgsWKBTypes .PolygonZ
2561
+ assert QgsWKBTypes .dropM (QgsWKBTypes .PolygonM ) == QgsWKBTypes .Polygon
2562
+ assert QgsWKBTypes .dropM (QgsWKBTypes .PolygonZM ) == QgsWKBTypes .PolygonZ
2563
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPolygon ) == QgsWKBTypes .MultiPolygon
2564
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPolygonZ ) == QgsWKBTypes .MultiPolygonZ
2565
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPolygonM ) == QgsWKBTypes .MultiPolygon
2566
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPolygonZM ) == QgsWKBTypes .MultiPolygonZ
2567
+ assert QgsWKBTypes .dropM (QgsWKBTypes .GeometryCollection ) == QgsWKBTypes .GeometryCollection
2568
+ assert QgsWKBTypes .dropM (QgsWKBTypes .GeometryCollectionZ ) == QgsWKBTypes .GeometryCollectionZ
2569
+ assert QgsWKBTypes .dropM (QgsWKBTypes .GeometryCollectionM ) == QgsWKBTypes .GeometryCollection
2570
+ assert QgsWKBTypes .dropM (QgsWKBTypes .GeometryCollectionZM ) == QgsWKBTypes .GeometryCollectionZ
2571
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CircularString ) == QgsWKBTypes .CircularString
2572
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CircularStringZ ) == QgsWKBTypes .CircularStringZ
2573
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CircularStringM ) == QgsWKBTypes .CircularString
2574
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CircularStringZM ) == QgsWKBTypes .CircularStringZ
2575
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CompoundCurve ) == QgsWKBTypes .CompoundCurve
2576
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CompoundCurveZ ) == QgsWKBTypes .CompoundCurveZ
2577
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CompoundCurveM ) == QgsWKBTypes .CompoundCurve
2578
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CompoundCurveZM ) == QgsWKBTypes .CompoundCurveZ
2579
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CurvePolygon ) == QgsWKBTypes .CurvePolygon
2580
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CurvePolygonZ ) == QgsWKBTypes .CurvePolygonZ
2581
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CurvePolygonM ) == QgsWKBTypes .CurvePolygon
2582
+ assert QgsWKBTypes .dropM (QgsWKBTypes .CurvePolygonZM ) == QgsWKBTypes .CurvePolygonZ
2583
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiCurve ) == QgsWKBTypes .MultiCurve
2584
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiCurveZ ) == QgsWKBTypes .MultiCurveZ
2585
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiCurveM ) == QgsWKBTypes .MultiCurve
2586
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiCurveZM ) == QgsWKBTypes .MultiCurveZ
2587
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiSurface ) == QgsWKBTypes .MultiSurface
2588
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiSurfaceZ ) == QgsWKBTypes .MultiSurfaceZ
2589
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiSurfaceM ) == QgsWKBTypes .MultiSurface
2590
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiSurfaceZM ) == QgsWKBTypes .MultiSurfaceZ
2591
+ assert QgsWKBTypes .dropM (QgsWKBTypes .NoGeometry ) == QgsWKBTypes .NoGeometry
2592
+ assert QgsWKBTypes .dropM (QgsWKBTypes .Point25D ) == QgsWKBTypes .Point25D
2593
+ assert QgsWKBTypes .dropM (QgsWKBTypes .LineString25D ) == QgsWKBTypes .LineString25D
2594
+ assert QgsWKBTypes .dropM (QgsWKBTypes .Polygon25D ) == QgsWKBTypes .Polygon25D
2595
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPoint25D ) == QgsWKBTypes .MultiPoint25D
2596
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiLineString25D ) == QgsWKBTypes .MultiLineString25D
2597
+ assert QgsWKBTypes .dropM (QgsWKBTypes .MultiPolygon25D ) == QgsWKBTypes .MultiPolygon25D
2483
2598
2484
2599
if __name__ == '__main__' :
2485
2600
unittest .main ()
0 commit comments